there is a pytorch version, trained with mobilenetv2, it is more simple.
introduction
This is a tensorflow implement mobilenetv3-centernet framework,
which can be easily deployeed on Android(MNN) and IOS(CoreML) mobile devices, end to end.
Purpose: Light detection algorithms that work on mobile devices is widely used,
such as face detection.
So there is an easy project contains model training and model converter.
python model_eval/custome_eval.py [--model [TRAINED_MODEL]] [--annFile [cocostyle annFile]]
[--imgDir [the images dir]] [--is_show [show the result]]
python model_eval/custome_eval.py --model model/detector.pb
--annFile ../mscoco/annotations/instances_val2017.json
--imgDir ../mscoco/val2017
--is_show 1
ps, no test time augmentation is used.
finetune
download the trained model,
modify the config config.MODEL.pretrained_model='yourmodel.ckpt',
and set config.MODEL.continue_train=True
python train.py
visualization
if u get a trained model and dont need to work on mobile device, run python tools/auto_freeze.py, it will read the checkpoint file in ./model, and produce detector.pb, then
python visualization/vis.py
u can check th code in visualization to make it runable, it's simple.
model convert for mobile device
I have carefully processed the postprocess, and it can works within the model, so it could be deployed end to end.
4.1 MNN
+ 4.1.1 convert model
just use the MNN converter, for example:
`./MNNConvert -f TF --modelFile detector.pb --MNNModel centernet.mnn --bizCode biz --fp16 1`
+ 4.1.2 visualization with mnn python wrapper
`python visualization/vis_with_mnn.py --mnn_model centernet.mnn --imgDir 'your image dir'`
请发表评论