Code Monkey home page Code Monkey logo

face-detector-1mb-with-landmark's People

Contributors

biubug6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

face-detector-1mb-with-landmark's Issues

关于转onnx和ncnn的param参数输出不同的问题

你好,首先非常感谢咱们的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模型输出的向量长度不一样呢?

Tensorrt Conversion

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.

collect2: error: ld returned 1 exit status

大佬好!这是我见过的最牛逼的仓库之一,感谢大佬的伟大贡献,当我在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均已正确安装,大佬可以指点下这个是哪里出了问题吗?

onnx2ncnn的问题

在执行./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,但是无效

CUDA out of memory when I try to detect face in CelebA dataset.

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.

NCNN library for android

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 :)

how to annotate landmark?

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.

请问大佬用的什么版本的ncnn?

用大佬的代码里自带的libncnn.a 在linux 上跑出来时间是60ms, 用最新版的ncnn 跑相同模型时间是280ms, 想问一下大佬用的什么版本的ncnn ,有没有做过优化?

Inference Speed and Precision on edge device

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?

landmarks

这个landmark ncnn输出的是一个10 4420 1 的维度的特征,如何转换为10个特征点呢

关于损失函数部分confidence的损失值的计算

loss_c = log_sum_exp(batch_conf) - batch_conf.gather(1, conf_t.view(-1, 1))
# Hard Negative Mining
loss_c[pos.view(-1, 1)] = 0 # filter out pos boxes for now
loss_c = loss_c.view(num, -1)
_, loss_idx = loss_c.sort(1, descending=True)
_, idx_rank = loss_idx.sort(1)
num_pos = pos.long().sum(1, keepdim=True)
num_neg = torch.clamp(self.negpos_ratio*num_pos, max=pos.size(1)-1)
neg = idx_rank < num_neg.expand_as(idx_rank)
# Confidence Loss Including Positive and Negative Examples
pos_idx = pos.unsqueeze(2).expand_as(conf_data)
neg_idx = neg.unsqueeze(2).expand_as(conf_data)
conf_p = conf_data[(pos_idx+neg_idx).gt(0)].view(-1,self.num_classes)
targets_weighted = conf_t[(pos+neg).gt(0)]
loss_c = F.cross_entropy(conf_p, targets_weighted, reduction='sum')

作者您好,我在阅读您的代码的这一部分产生了一点疑问,这一部分的代码在计算正负置信度的时候似乎与SSD那篇论文的方法不太一样,您在这里采用这种方法的依据或者原因是什么呢?
主要是log_sum_exp函数的实现原因,因为我看到有其他人计算(包括论文中)计算损失函数都是直接使用softmax loss进行计算不知道这里作者您的考量是什么呢?以及在log_sum_exp函数中使用x_max这个变量的原因是什么呢?
loss_c[pos.view(-1, 1)] = 0 # filter out pos boxes for now

这里的 = 0是不是应该换成 = -math.inf,因为这里如果loss_c为负的话,降序排列 0 还是会排在负样本前面,在L109-L110处得到的neg不是会包含有正样本吗?

About WiderFace test setting

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?

comment and code not matched in random crop

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?

widerface亲测疑问

先致谢作者,很棒的工作!
我亲测了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。

测试过程:

  1. 下载官方的WIDER Face Validation Images作为dataset_folder,并运行test_widerface.py得到一堆文本结果;
  2. 下载官方eval_tools.zip里的ground_truth,并运行evaluation.py得到上述结果。

不知我是不是哪里没搞对?

特征点增加至68点训练,效果很不好

大神,你好,请问我想人脸和特征点一起训练,特征点是68点(300W),但是训练出来的效果不是很好,我看你五点的效果还是很好的,请问我是不是要改变训练的方法?
Screenshot from 2019-11-28 09-47-03
Screenshot from 2019-11-28 09-47-44

Dense Regression loss

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 ?

onnx模型验证

您好,我想请问一下,转成onnx后,如何验证转成onnx模型的精度?有demo可以参考吗?

How to handle the faces without landmarks?

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?

landms_t[:, :, :2] = np.maximum(landms_t[:, :, :2], np.array([0, 0]))

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

Questions aboult weights

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?

onnx转换ncnn模型错误

非常感谢您的工作, 我按照您的说明产生了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!

axis=0

Shape not supported yet!
Gather not supported yet!

axis=0

Unsqueeze not supported yet!

axes 7

Unsqueeze not supported yet!

axes 7

Cast not supported yet!

to=1

Shape not supported yet!
Cast not supported yet!

to=1

Segmentation fault (core dumped)

请教您是怎么解决这个问题的,不胜感激!

RBF_Final.pth第一个batchnorm的 mean & val 为什么这么大

合并batchnorm后发现第一个卷积层的权重过小
对比原版的Ultra-Light-Fast-1M的原始model, RBF_Final.pth的第一个batchnorm的mean与val参数大的有些异常,求解。。。
RBF_Final.pth first batchnorm :
RBF_Final_1thbatchnorm
Ultra-Light-Fast-Generic-Face-Detector-1MB/models/pretrained/version-RFB-320.pth first batchnorm :
version-RFB-320_1thbatchnorm

为什么ncnn减均值需要6个ms左右

in.substract_mean_normalize(mean_vals, 0);
这一步需要6个ms左右,正常的分类模型只需要0.08ms,图片大小也是差不多的,有大佬解释一下嘛

Vertical screen big face easy to get wrong face location

src image
1person_2

result img
test

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.

How did you get "min_sizes" and "variance" in config.py?

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:

'min_sizes': [[10, 20], [32, 64], [128, 256]],
'steps': [8, 16, 32],
'variance': [0.1, 0.2],

'min_sizes': [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]],
'steps': [8, 16, 32, 64],
'variance': [0.1, 0.2],

'min_sizes': [[10, 16, 24], [32, 48], [64, 96], [128, 192, 256]],
'steps': [8, 16, 32, 64],
'variance': [0.1, 0.2],

Does that parameter follow some kind of formula or something?
Hope to have your response!

Best Regards,

数据集获取

您好,获取数据集的链接失效了,请问如何获取呢

run demo on jetson nano

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?

resize时长宽比的问题

detect.py里好像没考虑宽高哪个长的问题?输入图片是(240320)的话resize比例应该还是1吧,那怎么输入(320240)的网络呢

沒复现作者的结果,能给点建议吗?

作者你好,我按照你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

其他参数我都没敢改,请问能给点建议吗,谢谢了。

关于多分类

您好,我在处理多分类时,也就是num_classes = 3,在塞数据的地方annotation[0, 14]的地方多了一个label,也就是标签有-1,1,2,但是这样子训练之后网络并不能较好地区分处理,结果是算法推理的结果基本都偏向于标签为1,请问下有什么比较好的解决方法吗~ 麻烦您指教下~感激不尽

如何在样本中增加负样本?

   感谢您这么棒的工作,我想请教下您提供的widerface训练集的标签里面很多样本label被设置为-1,这是把那些小脸或者模糊的脸直接作为负样本吗?
   如果我想减少模型对于一些场景的误识别,也认为把一些容易识别错误的目标设为-1,这样在计算loss的时候负样本的选取会优先考虑这部分标注过的负样本吗。
   但是在看multibox_loss函数的时候好像还是把所有的负样本按照loss的排序排序选取前面一部分,这样的话如果与我标记的负样本匹配的defaultbox的loss不是排在前面,它还是会被筛选掉。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.