davisking/dlib-models

Android app crash

mateusz5314 opened this issue · 1 comments

Hi, i would like to run your age predictor on android. I am able to compile and run app but when i put this line
deserialize("/sdcard/dnn_age_predictor_v1.dat") >> age_net;
app is crushing. File is available and deserializing is ok bcs. when i comment ">> age_net" its not crushing.
I also use all your implementation to apredictor_t type. Its look like
const unsigned long number_of_age_classes = 81;

// The resnet basic block.
template<
int num_filters,
template class BN, // some kind of batch normalization or affine layer
int stride,
typename SUBNET

using basicblock = BN<con<num_filters, 3, 3, 1, 1, relu<BN<con<num_filters, 3, 3, stride, stride, SUBNET>>>>>;

// A residual making use of the skip layer mechanism.
template<
template<int, template class, int, typename> class BLOCK, // a basic block defined before
int num_filters,
template class BN, // some kind of batch normalization or affine layer
typename SUBNET

// adds the block to the result of tag1 (the subnet)
using residual = add_prev1<BLOCK<num_filters, BN, 1, tag1>>;

// A residual that does subsampling (we need to subsample the output of the subnet, too).
template<
template<int, template class, int, typename> class BLOCK, // a basic block defined before
int num_filters,
template class BN,
typename SUBNET

using residual_down = add_prev2<avg_pool<2, 2, 2, 2, skip1<tag2<BLOCK<num_filters, BN, 2, tag1>>>>>;

// Residual block with optional downsampling and batch normalization.
template<
template<template<int, template class, int, typename> class, int, templateclass, typename> class RESIDUAL,
template<int, template class, int, typename> class BLOCK,
int num_filters,
template class BN,
typename SUBNET

using residual_block = relu<RESIDUAL<BLOCK, num_filters, BN, SUBNET>>;

template<int num_filters, typename SUBNET>
using aresbasicblock_down = residual_block<residual_down, basicblock, num_filters, affine, SUBNET>;

// Some useful definitions to design the affine versions for inference.
template using aresbasicblock256 = residual_block<residual, basicblock, 256, affine, SUBNET>;
template using aresbasicblock128 = residual_block<residual, basicblock, 128, affine, SUBNET>;
template using aresbasicblock64 = residual_block<residual, basicblock, 64, affine, SUBNET>;

// Common input for standard resnets.
template
using aresnet_input = max_pool<3, 3, 2, 2, relu<affine<con<64, 7, 7, 2, 2, INPUT>>>>;

// Resnet-10 architecture for estimating.
template
using aresnet10_level1 = aresbasicblock256<aresbasicblock_down<256, SUBNET>>;
template
using aresnet10_level2 = aresbasicblock128<aresbasicblock_down<128, SUBNET>>;
template
using aresnet10_level3 = aresbasicblock64;
// The resnet 10 backbone.
template
using aresnet10_backbone = avg_pool_everything<
aresnet10_level1<
aresnet10_level2<
aresnet10_level3<
aresnet_input>>>>;

using apredictor_t = loss_multiclass_log<fc<number_of_age_classes, aresnet10_backbone<input_rgb_image>>>;

apredictor_t age_net;

Don't have any idea. Has you?

same problem for gender classifier