biubug6 / face-detector-1mb-with-landmark Goto Github PK
View Code? Open in Web Editor NEW1M人脸检测模型(含关键点)
License: MIT License
1M人脸检测模型(含关键点)
License: MIT License
非常感谢您的工作, 我按照您的说明产生了onnx文件,接着转换ncnn的时候有如下报错:
./onnx2ncnn faceDetector.onnx m25.param m25.bin
./onnx2ncnn: symbol lookup error: ./onnx2ncnn: undefined symbol: _ZN6google8protobuf2io17CodedOutputStream21WriteVarint32SlowPathEj
当我使用自己编译好的ncnn时,又出现了一些不支持的问题:
ncnn/build/tools/onnx/onnx2ncnn faceD
etector.onnx m25.param m25.bin
Shape not supported yet!
Gather not supported yet!
Shape not supported yet!
Gather not supported yet!
Unsqueeze not supported yet!
Unsqueeze not supported yet!
Cast not supported yet!
Shape not supported yet!
Cast not supported yet!
Segmentation fault (core dumped)
请教您是怎么解决这个问题的,不胜感激!
在执行./onnx2ncnn face.param face.bin时报错:
./onnx2ncnn: error while loading shared libraries: libprotobuf.so.20: cannot open shared object file: No such file or directory
请问该如何解决?
有尝试过onnx/onnx#2434 中的conda install protobuf=3.9,但是无效
你好,首先非常感谢咱们的project。使用过程中发现几个问题。
使用咱们提供的转onxx代码转换mobile0.25的模型并simple后,输层名称分别是,586,output0和585,使用netron查看后可看见:
(1)output0是1 * 4200 * 4的输出;
(2)586是1 * 4200 * 2的输出;
(3)585是1 * 4200 * 10的输出;
然后将其按照咱们过程转为ncnn模型,然后:
std::cout<<"output0 shape = "<<out.c <<" "<<out.w <<" "<<out.h <<" "<<out.elemsize<<std::endl;
std::cout<<"586 shape = "<<out1.c<<" "<<out1.w<<" "<<out1.h<<" "<<out1.elemsize<<std::endl;
std::cout<<"585 shape = "<<out2.c<<" "<<out2.w<<" "<<out2.h<<" "<<out2.elemsize<<std::endl;
打印后,输出分别为:
output0 shape = 1 4 3160 4
586 shape = 1 2 3160 4
585 shape = 1 10 3160 4
slim模型也有同样的问题,onnx的是5875 * 4(或者2或者10),但param的是4200 * 4(或者2或者10)。
问题是:为什么咱们这里的onnx模型和param模型输出的向量长度不一样呢?
I saw that in the labels with landmark, there are still some faces are not labeled with landmarks, how to handle this case in the training?
From the code, it seems that, the landmarks were "-1" and in data_augment.py line 56, negative values are clipped to 0s. Does that effect the training result?
Another question is related to augmentation, when some of the face landmarks are out of the boundaries of cropped image, how to handle those missing landmarks?
thanks
Hello,
can you please provide MNN implementation like https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB have provided.
./weights/mobilenetV1X0.25_pretrain.tar 兄弟 ,这个文件我没找到下载地方
感谢您这么棒的工作,我想请教下您提供的widerface训练集的标签里面很多样本label被设置为-1,这是把那些小脸或者模糊的脸直接作为负样本吗?
如果我想减少模型对于一些场景的误识别,也认为把一些容易识别错误的目标设为-1,这样在计算loss的时候负样本的选取会优先考虑这部分标注过的负样本吗。
但是在看multibox_loss函数的时候好像还是把所有的负样本按照loss的排序排序选取前面一部分,这样的话如果与我标记的负样本匹配的defaultbox的loss不是排在前面,它还是会被筛选掉。
在Ultra-Light-Fast-Generic-Face-Detector-1MB中推理没有用到prior_box,对照ssd,你的代码是是用到了prio_box,这样在推理时会增加计算量,这样做是为了更好的训练结果吗?
I am trying to run the model on Android. But the inference results are random. Its seems there could be library mismatch and model.
Does anyone know the library version ??
Any help would be appreciated :)
您好,我在处理多分类时,也就是num_classes = 3,在塞数据的地方annotation[0, 14]的地方多了一个label,也就是标签有-1,1,2,但是这样子训练之后网络并不能较好地区分处理,结果是算法推理的结果基本都偏向于标签为1,请问下有什么比较好的解决方法吗~ 麻烦您指教下~感激不尽
why?
the command as follow:
python detect.py --network mobile0.25 --trained_model ./weights/mobilenet0.25_Final.pth
or
python detect.py --network RFB --trained_model ./weights/RBF_Final.pth
or
python detect.py --network slim --trained_model ./weights/slim_Final.pth
are the same wrong result.
您好,获取数据集的链接失效了,请问如何获取呢
Dear @biubug6,
Deeper to anchor boxes, I got stuck as min_sizes and variance parameter in config.py.
Except the "steps" values, I understand it came from size of FPN. But how can you get the values of "min_size" and "variance" liked:
Face-Detector-1MB-with-landmark/data/config.py
Lines 4 to 6 in 2b07565
Face-Detector-1MB-with-landmark/data/config.py
Lines 24 to 26 in 2b07565
Face-Detector-1MB-with-landmark/data/config.py
Lines 40 to 42 in 2b07565
Does that parameter follow some kind of formula or something?
Hope to have your response!
Best Regards,
Face-Detector-1MB-with-landmark/layers/modules/multibox_loss.py
Lines 101 to 117 in 2b07565
= 0
是不是应该换成 = -math.inf
,因为这里如果loss_c为负的话,降序排列 0 还是会排在负样本前面,在L109-L110处得到的neg不是会包含有正样本吗?Hi,
Thanks for this awesome work.
I was tried to convert this models to tensorrt .plan model but getting some cuda-convolutions errors while executing
I converted torch model -> onnx -> trt model. But not able to execute them perfectly.
Did anyone tried to convert this model to tensorrt?
Please share your approach.
用大佬的代码里自带的libncnn.a 在linux 上跑出来时间是60ms, 用最新版的ncnn 跑相同模型时间是280ms, 想问一下大佬用的什么版本的ncnn ,有没有做过优化?
作者你好,我按照你README,下载了数据集,然后跑了两个实验
用的是RetinaFace mobile0.25,一个是不用ImageNet预训的模型的,一个是用了预训练模型
可是我的map如下:
不用预训练模型的:
Easy Val AP: 0.7675
Medium Val AP: 0.6577
Hard Val AP: 0.3344
用了预训练模型的:
Easy Val AP: 0.7864
Medium Val AP: 0.668
Hard Val AP: 0.3388
其他参数我都没敢改,请问能给点建议吗,谢谢了。
先致谢作者,很棒的工作!
我亲测了RFB在widerface的结果,似乎有所差异:
==================== Results ====================
Easy Val AP: 0.7425689536559531
Medium Val AP: 0.5656252263367466
Hard Val AP: 0.24684904010538217
=================================================
我用默认提供的RFB模型,长边320等比缩放,thres_cls = 0.6,thres_nms = 0.4。
测试过程:
不知我是不是哪里没搞对?
对于这种需求
是使用mtcnn呢?
还是修改retinaface-mnet.25呢?
还是修改这个face-detector-1mb-with-landmark呢?
如果是修改后2个one-stage的网络的话,该如何下手呢?
谢谢。
想测试一下landmark的NME效果,但是不知道流程,希望能提供,非常感谢
请教博主怎样修改代码可以实现多分类呢?例如:face+人体+face landmark的实现
大佬好!这是我见过的最牛逼的仓库之一,感谢大佬的伟大贡献,当我在ncnn哪里执行 make -j4 i的时候每次到100%就报错了:
[100%] Linking CXX executable FaceDetector
...
detectionoutput.cpp:(.text+0x3af): undefined reference to `__expf_finite'
/usr/bin/ld: detectionoutput.cpp:(.text+0x3cb): undefined reference to `__expf_finite'
/usr/bin/ld: /home/felix/PycharmProjects/Face-Detector-1MB-with-landmark/Face_Detector_ncnn/ncnn/lib/libncnn.a(deconvolutiondepthwise.cpp.o): in function `ncnn::DeconvolutionDepthWise::forward(ncnn::Mat const&, ncnn::Mat&, ncnn::Option const&) const [clone ._omp_fn.0]':
deconvolutiondepthwise.cpp:(.text+0x6c6): undefined reference to `__expf_finite'
/usr/bin/ld: /home/felix/PycharmProjects/Face-Detector-1MB-with-landmark/Face_Detector_ncnn/ncnn/lib/libncnn.a(deconvolutiondepthwise.cpp.o):deconvolutiondepthwise.cpp:(.text+0xee9): more undefined references to `__expf_finite' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/FaceDetector.dir/build.make:120:FaceDetector] error 1
make[1]: *** [CMakeFiles/Makefile2:83:CMakeFiles/FaceDetector.dir/all] error2
make: *** [Makefile:91:all] error2
环境是ubuntu20.04,ncnn,vulkan,opencv均已正确安装,大佬可以指点下这个是哪里出了问题吗?
in data/data_augment.py, line 61
# make sure that the cropped image contains at least one face > 16 pixel at training image scale
b_w_t = (boxes_t[:, 2] - boxes_t[:, 0] + 1) / w * img_dim
b_h_t = (boxes_t[:, 3] - boxes_t[:, 1] + 1) / h * img_dim
mask_b = np.minimum(b_w_t, b_h_t) > 5
choose a box size larger than 5, not 16
why?
label为-1 仅仅是因为一些人脸无法标注关键点信息, 只是用来回归位置信息(不回归关键点信息)
Originally posted by @biubug6 in #14 (comment)
which version face.param face.bin saved in models are, RFB? slim? retinaface mb0.25?
按照你的ncnn,我搞了好久MNN的部署都没成功,预测出的结果总是不正确。。。
hi,thanks for your great job,I want to modify network into 160160 or 160120 input ,I wonder whether I need to provided new box and landmark coordinaties ,or the code will auto change itself,can you tell me where is the reference code ,thanks so much!
I run the demo on jetson nano, but it has an error when I built project:
/usr/bin/ld : skipping incompatible /........./Face-Detector-1MB-with-landmark/Face_Detector_ncnn/ncnn/lib/libncnn.a when searching for -lncnn
/usr/bin/ld : cannot find -lncnn
have any solution for this error?
in.substract_mean_normalize(mean_vals, 0);
这一步需要6个ms左右,正常的分类模型只需要0.08ms,图片大小也是差不多的,有大佬解释一下嘛
detect.py里好像没考虑宽高哪个长的问题?输入图片是(240320)的话resize比例应该还是1吧,那怎么输入(320240)的网络呢
这个landmark ncnn输出的是一个10 4420 1 的维度的特征,如何转换为10个特征点呢
In Git Hub repo, I am unable to find Dense Regression Loss . Either it is not calculated or used. Does any on else also face this ?
I noticed that original version-slim/version-RFB are tested by resizing the image to a fix size 320x240 or 640x480.
RetinaFace-mnet (Retinaface-Mobilenet-0.25), from a great job insightface, when testing this network, the original image is scaled by 320 or 640 as the maximum side length, so the face will not be deformed, and the rest of the networks will have a fixed size resize. At the same time, the result of the RetinaFace-mnet optimal 1600 single-scale val set was 0.887 (Easy) / 0.87 (Medium) / 0.791 (Hard).
While in your test images are resized by max-side to 320 or 640, is it?
And I'm not sure whether this will give a decrease on original version-slim/RFB's test results?
biubug6 你好!我发现1024X768的图片在减均值时要消耗10ms,既在执行 image -= (104, 117, 123) 时,时间消耗会 随着图片尺寸的变大而增加。所以想请问一下,这一步有什么优化方法吗?十分感谢!
Hi guys, I'm trying to make new bboxes for CelebA data set because the available ones are not tight enough for my use.
I find this project is what I need, but when running detect.py, I had some issues after some small changes like making a file list then performing the face detection and writing out.
After over 20000 images, the program crashed, and throughout this: CUDA was out of memory.
I had googled and found some solutions such as: using "with torch.no_grad()" or trying to free memory when it's not being used. But they still didn't work out as I expected.
Could you guys help me solve this problem?
Thanks in advance.
When the input size is 320*240, the speed of Face-Detector is higher than MTCNN's, but the results of AP of retinaface-m0.25 will be lower than MTCNN's on WIDERFACE-val.
When the input size is 640*480, the results of AP of retinaface-m0.25 will be lower than MTCNN's on WIDERFACE-val, but the speed of Face-Detector is lower than MTCNN's.
How do you think these models inference on edge device?
测试时候贴的性能对比,都是320x240,640x480的
May i ask u that what the last word of annotation of Wider face refers to?
(i.e.# 0--Parade/0_Parade_Parade_0_904.jpg
361 98 263 339 424.143 251.656 0.0 547.134 232.571 0.0 494.121 325.875 0.0 453.83 368.286 0.0 561.978 342.839 0.0 0.89)
what does "0.89" refers to?
look forward your replying.
there is no face detected when I change the model to mobilenet0.25 and the nodes name of out out1 out2 to output0 586 585.
您好,我想请问一下,转成onnx后,如何验证转成onnx模型的精度?有demo可以参考吗?
there are three files in weights dir:
mobilenet0.25_Final.pth
RBF_Final.pth
slim_Final.pth
the "convert_to_onnx.py" user long_side param to Specifies the w&h.
but i found the w&h are the same, on Ultra-Light-Fast-Generic-Face-Detector-1MB, the author has two pretrain weight: 320240 and 640480.
Did you use different resolution to train the network?
What resolution is the model on weights dir trained with?yk
Is the same weight use to test the wider face val of different resolution(320240 640480), only resize input image to different resolution?
@biubug6 If I want to train 160x160 network, how should I design the anchor?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.