chenjun2hao / centerface.pytorch Goto Github PK
View Code? Open in Web Editor NEWunofficial version of centerface, which achieves the best balance between speed and accuracy at face detection
unofficial version of centerface, which achieves the best balance between speed and accuracy at face detection
Hi, thank you for your work. I'm curious about the model size. In the origin repo, the model size is 7.3M, while your pre-trained model is 22.3M, do you check this number?
i want to train widerface data,when i run python main.py in folder src , meet the follow error:
from torch._six import container_abcs, string_classes, int_classes
ImportError: cannot import name 'container_abcs'
how can i correct this problem,thanks very much.
请问总损失一直维持在2.2,是什么问题呢,参数改了调小了初始学习率,总损失应该维持在多少大小?
你好,我想请问一下具体是在多少个epoch后做finetune的呢,finetune的学习率和步长具体是多少呢?
我在640 * 640的输入上做训练,使用lr_step为90、120,lr为5e-4,batch_size为8。之后将140的epoch取出,送入第二步做finetune,输入尺寸为800 * 800,使用lr_step为30、60,lr为5e-4,batch_size为8。
1.First train with the size of 640×640/514×514
2.Then fine tune with the size of 800×800
3.For the easy and hard part, s = s * np.random. Choice (np.arange(0.3, 1.2, 0.1)). The larger the value, the more small samples will be generated
Thanks for sharing!
Baidu cloud link seems not available, please check
Hi, can you provide the annotation file again? It will help a lot, thx!
paddlepaddle,tensorflow,pytorch都安装了,程序中有用到所有的框架吗?
could you provide google drive link for all
Fix size testing.
training chunk_sizes: [15]
The output will be saved to /content/drive/My Drive/CenterFace.pytorch/src/lib/../../exp/multi_pose/mobilev2_10
heads {'hm': 1, 'wh': 2, 'hm_offset': 2, 'landmarks': 10}
Namespace(K=200, aggr_weight=0.0, agnostic_ex=False, arch='mobilev2_10', aug_ddd=0.5, aug_rot=0, batch_size=8, cat_spec_wh=False, center_thresh=0.1, chunk_sizes=[15], data_dir='/content/drive/My Drive/CenterFace.pytorch/src/lib/../../data', dataset='facehp', debug=0, debug_dir='/content/drive/My Drive/CenterFace.pytorch/src/lib/../../exp/multi_pose/mobilev2_10/debug', debugger_theme='white', demo='/home/yangna/data/WIDER_FACE/WIDER_train/images/0--Parade/0_Parade_marchingband_1_80.jpg', dense_hp=False, dense_wh=False, dep_weight=1, dim_weight=1, down_ratio=4, eval_oracle_dep=False, eval_oracle_hm=False, eval_oracle_hmhp=False, eval_oracle_hp_offset=False, eval_oracle_kps=False, eval_oracle_offset=False, eval_oracle_wh=False, exp_dir='/content/drive/My Drive/CenterFace.pytorch/src/lib/../../exp/multi_pose', exp_id='dla', fix_res=True, flip=0.5, flip_idx=[[0, 1], [3, 4]], flip_test=False, gpus=[0], gpus_str='0', head_conv=64, heads={'hm': 1, 'wh': 2, 'hm_offset': 2, 'landmarks': 10}, hide_data_time=False, hm_hp=True, hm_hp_weight=1, hm_weight=1, input_h=800, input_res=800, input_w=800, keep_res=False, kitti_split='3dop', lm_weight=0.1, load_model='', lr=0.000125, lr_step=[30, 80], master_batch_size=15, mean=array([[[0.40789655, 0.44719303, 0.47026116]]], dtype=float32), metric='loss', mse_loss=False, nms=False, no_color_aug=False, norm_wh=False, not_cuda_benchmark=False, not_hm_hp=False, not_prefetch_test=False, not_rand_crop=False, not_reg_bbox=False, not_reg_hp_offset=False, not_reg_offset=False, num_classes=1, num_epochs=140, num_iters=-1, num_stacks=1, num_workers=4, off_weight=1, output_h=200, output_res=200, output_video='../output/res_3.mp4', output_w=200, pad=31, peak_thresh=0.2, print_iter=0, rect_mask=False, reg_bbox=True, reg_hp_offset=True, reg_loss='sl1', reg_offset=True, resume=False, root_dir='/content/drive/My Drive/CenterFace.pytorch/src/lib/../..', rot_weight=1, rotate=0, save_all=True, save_dir='/content/drive/My Drive/CenterFace.pytorch/src/lib/../../exp/multi_pose/mobilev2_10', scale=0.4, scores_thresh=0.1, seed=317, shift=0.1, std=array([[[0.2886383 , 0.27408165, 0.27809834]]], dtype=float32), task='multi_pose', test=False, test_scales=[1.0], train_json=None, trainval=False, val_intervals=5, val_json=None, vis_thresh=0.4, wh_weight=0.1)
cp: target 'Drive/CenterFace.pytorch/src/lib/../../exp/multi_pose/mobilev2_10/logs_2020-08-19-12-45/' is not a directory
Creating model...
Setting up data...
==> initializing centerface key point val data.
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
Loaded val 0 samples
==> initializing centerface key point train data.
loading annotations into memory...
Done (t=0.77s)
creating index...
index created!
Loaded train 12671 samples
Starting training...
multi_pose/dlaTraceback (most recent call last):
File "main.py", line 110, in
main(opt)
File "main.py", line 78, in main
log_dict_train, _ = trainer.train(epoch, train_loader)
File "/content/drive/My Drive/CenterFace.pytorch/src/lib/trains/base_trainer.py", line 118, in train
return self.run_epoch('train', epoch, data_loader)
File "/content/drive/My Drive/CenterFace.pytorch/src/lib/trains/base_trainer.py", line 60, in run_epoch
for iter_id, batch in enumerate(data_loader):
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 363, in next
data = self._next_data()
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 989, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 1014, in _process_data
data.reraise()
File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 395, in reraise
raise self.exc_type(msg)
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 185, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/content/drive/My Drive/CenterFace.pytorch/src/lib/datasets/sample/multi_pose.py", line 50, in getitem
img, anns = Data_anchor_sample(img, anns)
File "/content/drive/My Drive/CenterFace.pytorch/src/lib/utils/utils.py", line 38, in Data_anchor_sample
height, width, _ = image.shape
AttributeError: 'NoneType' object has no attribute 'shape'
使用最新的代码和wider face数据集(anno file从主页推荐的百度网盘下载的,val的anno貌似没有任何图片信息)进行训练,训练5次后loss出现NAN,且一直是NAN,请问是什么问题?
日志如下:
2020-05-28-20-43: epoch: 1 |hm_loss 134.458721 | wh_loss 0.675813 | lm_loss 2.126231 | time 2.216667 | loss 134.929304 | off_loss 0.190378 |
2020-05-28-20-45: epoch: 2 |hm_loss 8.054886 | wh_loss 0.578012 | lm_loss 2.000603 | time 2.200000 | loss 8.407020 | off_loss 0.094272 |
2020-05-28-20-47: epoch: 3 |hm_loss 3.317343 | wh_loss 0.546710 | lm_loss 1.981100 | time 2.200000 | loss 3.659947 | off_loss 0.089822 |
2020-05-28-20-49: epoch: 4 |hm_loss 1.972609 | wh_loss 0.476618 | lm_loss 2.065705 | time 2.200000 | loss 2.307610 | off_loss 0.080769 |
2020-05-28-20-51: epoch: 5 |hm_loss 1.477579 | wh_loss 0.284628 | lm_loss 1.835134 | time 2.200000 | loss 1.764335 | off_loss 0.074779 | hm_loss 1.495690 | wh_loss 0.301853 | lm_loss 1.877964 | time 3.700000 | loss 1.790609 | off_loss 0.076937 |
2020-05-28-20-57: epoch: 6 |hm_loss nan | wh_loss nan | lm_loss nan | time 2.166667 | loss nan | off_loss nan |
2020-05-28-20-59: epoch: 7 |hm_loss nan | wh_loss nan | lm_loss nan | time 2.183333 | loss nan | off_loss nan |
2020-05-28-21-02: epoch: 8 |hm_loss nan | wh_loss nan | lm_loss nan | time 2.183333 | loss nan | off_loss nan |
2020-05-28-21-04: epoch: 9 |hm_loss nan | wh_loss nan | lm_loss nan | time 2.183333 | loss nan | off_loss nan |
2020-05-28-21-06: epoch: 10 |hm_loss nan | wh_loss nan | lm_loss nan | time 2.183333 | loss nan | off_loss nan | hm_loss nan | wh_loss nan | lm_loss nan | time 3.700000 | loss nan | off_loss nan |
2020-05-28-21-12: epoch: 11 |hm_loss nan | wh_loss nan | lm_loss nan | time 2.166667 | loss nan | off_loss nan |
配置如下:
==> torch version: 1.2.0
==> cudnn version: 7602
==> Cmd:
['main.py', '--input_res', '512']
==> Opt:
K: 200
aggr_weight: 0.0
agnostic_ex: False
arch: mobilev2_10
aug_ddd: 0.5
aug_rot: 0
batch_size: 8
cat_spec_wh: False
center_thresh: 0.1
chunk_sizes: [15]
data_dir: /home/rji/workspace/CenterFace/src/lib/../../data
dataset: facehp
debug: 0
debug_dir: /home/rji/workspace/CenterFace/src/lib/../../exp/multi_pose/mobilev2_10/debug
debugger_theme: white
demo: /home/yangna/data/WIDER_FACE/WIDER_train/images/0--Parade/0_Parade_marchingband_1_80.jpg
dense_hp: False
dense_wh: False
dep_weight: 1
dim_weight: 1
down_ratio: 4
eval_oracle_dep: False
eval_oracle_hm: False
eval_oracle_hmhp: False
eval_oracle_hp_offset: False
eval_oracle_kps: False
eval_oracle_offset: False
eval_oracle_wh: False
exp_dir: /home/rji/workspace/CenterFace/src/lib/../../exp/multi_pose
exp_id: dla
fix_res: True
flip: 0.5
flip_idx: [[0, 1], [3, 4]]
flip_test: False
gpus: [0]
gpus_str: 0
head_conv: 64
heads: {'landmarks': 10, 'hm_offset': 2, 'wh': 2, 'hm': 1}
hide_data_time: False
hm_hp: True
hm_hp_weight: 1
hm_weight: 1
input_h: 512
input_res: 512
input_w: 512
keep_res: False
kitti_split: 3dop
lm_weight: 0.1
load_model:
lr: 0.000125
lr_step: [30, 80]
master_batch_size: 15
mean: [[[0.40789655 0.44719303 0.47026116]]]
metric: loss
mse_loss: False
nms: False
no_color_aug: False
norm_wh: False
not_cuda_benchmark: False
not_hm_hp: False
not_prefetch_test: False
not_rand_crop: False
not_reg_bbox: False
not_reg_hp_offset: False
not_reg_offset: False
num_classes: 1
num_epochs: 140
num_iters: -1
num_stacks: 1
num_workers: 4
off_weight: 1
output_h: 128
output_res: 128
output_video: ../output/res_3.mp4
output_w: 128
pad: 31
peak_thresh: 0.2
print_iter: 0
rect_mask: False
reg_bbox: True
reg_hp_offset: True
reg_loss: sl1
reg_offset: True
resume: False
root_dir: /home/rji/workspace/CenterFace/src/lib/../..
rot_weight: 1
rotate: 0
save_all: True
save_dir: /home/rji/workspace/CenterFace/src/lib/../../exp/multi_pose/mobilev2_10
scale: 0.4
scores_thresh: 0.1
seed: 317
shift: 0.1
std: [[[0.2886383 0.27408165 0.27809834]]]
task: multi_pose
test: False
test_scales: [1.0]
train_json: None
trainval: False
val_intervals: 5
val_json: None
vis_thresh: 0.4
wh_weight: 0.1
1、Your mobilenetv2 is original structure whose activation is relu6 , And the original centerface is relu. Have try the relu version?
2、Also your custom centerface is trained with the five landmarks? or you just trained the bbox with no landmarks?
original centerface's landmarks are trained by the offset regression not heat map and its' size added the log regression .
I found the net speed is 40ms When I tested the model in my computer with dgx1080. Is this speed normal?
python main.py
I dont change the setting to train
4 |ETA: 0:05:49 |loss nan |hm_loss nan |lm_loss nan |wh_loss nan |off_loss nanmulti_pose/dla |########### | train: [8][546/1583]|Tot: 0:03:05 |ETA: 0:05:49 |loss nan |hm_loss nan |lm_loss nan |wh_loss nan |off_lo
how to resize your images size for training
Hi,
I am not able to download the model weights after I enter the password and when I click on download button it asks for more information. Could you please provide the weight file?
The link of COCO format annotation file has be removed by Baidu cloud?
Can you provide it again?
When the image infer by the model, the image downsize 4x, the small face is 2-5 pixl in my data ,the keypoint heatmap center is very close, and then After the 3x3 maxpooling, the 5 keypoints may doublication, the 3x3 maxpooling is not suit me, How can i slove the problem, Can you gays give me some advise?
I have tried training directly with 800x800, the result is not as well as training with 512x512 and fine tuning with 800x800.
why this happened?
您好,大神,训练过程中突然出现这个问题,怎么解决呢?
multi_pose/dla |################# | train: [4][882/1583]|Tot: 0:02:16 |ETA: 0:01:49 |loss 3.2818 |hm_loss 2.8268 |lm_loss 3.1342 |wh_loss 0.5359 |off_loss 0.0880 |Data 0.001s(0.002s) |Net 0.multi_pose/dla |################# | train: [4][883/1583]|Tot: 0:02:16 |ETA: 0:01:49 |loss 3.2804 |hm_loss 2.8256 |lm_loss 3.1322 |wh_loss 0.5357 |off_loss 0.0880 |Data 0.001s(0.002s) |Net 0.multi_pose/dla |################# | train: [4][884/1583]|Tot: 0:02:16 |ETA: 0:01:48 |loss 3.2805 |hm_loss 2.8258 |lm_loss 3.1317 |wh_loss 0.5357 |off_loss 0.0880 |Data 0.001s(0.002s) |Net 0.multi_pose/dla |################# | train: [4][885/1583]|Tot: 0:02:16 |ETA: 0:01:47 |loss 3.2797 |hm_loss 2.8251 |lm_loss 3.1297 |wh_loss 0.5357 |off_loss 0.0880 |Data 0.002s(0.002s) |Net 0.multi_pose/dla |################################| train: [4][1582/1583]|Tot: 0:04:02 |ETA: 0:00:01 |loss nan |hm_loss nan |lm_loss nan |wh_loss nan |off_loss nan |Data 0.001s(0.001s) |Net 0.153s
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
WARNING:root:NaN or Inf found in input tensor.
@chenjun2hao
Hi, I found the head conv channels is 64 but the ori paper is 24. Is there any reason to change the channels?
There is an error in post-processing of tensorrt output. I converted the model into onnx and then trt.
Running on jetson nano, cuda 10, tensorrt 6, torch 1.2.
File "demo_tensorrt.py", line 107, in
detections = body_engine.run(rgb_img)[1]
File "ML/CenterFace.pytorch/TensorRT/centernet_tensorrt_engine.py", line 58, in run
predictions = self.postprocess(trt_output, meta)
File "ML/CenterFace.pytorch/TensorRT/centernet_tensorrt_engine.py", line 201, in postprocess
hm, wh, hps, reg, hm_hp, hp_offset = args[0]; meta = args[1]
ValueError: not enough values to unpack (expected 6, got 4)
gt数据加载,代码里设置了人数限制。这里推理人群图片会容易造成漏检吧?
我使用你的代码进行训练,但精度只有 0.78 0.77和0.58,请问一下,您是用了哪些技巧呢,谢谢
Really Nice Tutorial..
I have trained using code from https://github.com/siriusdemon/Build-Your-Own-Face-Model/tree/master/detection centerface detection and facing Accuracy Issue.
Some Modifications I have done according to your repo as follows
HeatMap generation using your code.
FocalLoss implementation for heatmap loss
removed landmark generation layer.
Data augmentation ( random crop, random scale, translation) from https://github.com/Paperspace/DataAugmentationForObjectDetection
I have trained Mobilnet_10 model with pretrained weights upto 90 epochs with LR 5e-4 and facing accuracy problem as compared to original centerface model.
Also during inference if i use threshold to 0.50, 1000+ face detections are made (false detection)
Can you help?
It seems like there were a few wrong annos in the file.
There are different tasks including ctdet,ddd, multi_pose and exdet. What do they mean?
Could you please introduce them in details.
And in the dataset folder, some filename end with "hp", for example, centerface_hp. What do "hp" mean?
Thank you very much.
我直接使用后 发现图片检测的都是错的,标注的类别是pig
1.注意到您发布的模型中FPN通道数为64,而centerface中FPN的通道数为24。
2.您代码中的后处理用的nms是centernet中的pooling的方式,而centerface官方的代码中采用的是计算IOU的方式,请问您是否对这两种方式都进行测试过?是不是会对精度有一定影响呢?
can you get me the annotation of the validation set. Thank you
求一份训练数据,谢谢
我的邮箱:[email protected]
自行训练的数据发现人脸倾斜时,关键点预测不准,在训练上有什么优化策略么?
感谢您的开源, 请问为何预处理要用复杂的warpAffine 直接使用resize_with_padding可以吗?我测了下发现结果差距很大,请问为什么要使用warpAffine做图片的预处理和结果的后处理。
Baidu is not available. File is removed.
Please upload to dropbox
直接进入src中执行python test_wider_face.py就报这个错误。
当然我后来改了用sys.path.append('lib/detectors'), sys.path.append('lib/datasets'),
然后from detector_factory import detector_factory
这样就在这一步导入没问题。
但是后面detector_factory.py中的带前点的import全都要去掉点,以及要from external.nms import xx的时候又出问题。搞不清这个路径到底该如何导入了,感觉有点复杂。
我准备试试如果在训练随机crop正方形然后resize成300之后,测试时候的尺度也按照长宽比长边resize到300附近,这样看看 性能下降多少
您的DECODE 跟这个Star-Clouds感觉不大一样
可大致说明一下您的DECODE设计原理嘛
thanks
https://github.com/chenjun2hao/CenterFace.pytorch/blob/master/src/lib/models/decode.py
VS
https://github.com/Star-Clouds/CenterFace/blob/master/prj-python/centerface.py
For face detection, when a face show the bound of image and it only show the eyes,nose.(no mouth)
How to solve it with labeling. Drop it or label it ?
Thanks for your work. I have trained a face detection model. What should I do if I want to train a model with five landmarks? I mean which file shuold I change? Annotations format? Preprocess? And any other place? Thanks
感谢您的分享!
验证集标注文件地址(下面这行)对应的百度云链接已失效
download the validation set of WIDER_FACE password: y4wg
方便再更新一下吗?谢谢!
baidu url https://pan.baidu.com/s/1b5Uku0Bb13Zk9mf7mkZ3FA fail
Hi:
Could you please share the link again?
Hi, thanks for sharing the nice work!
When I did the test with your pretrained model on my own PC, I got the same results as yours with respect to 'easy' and 'medium' validation set of WIDERFACE. However, I found that there was some difference by 'hard' validation set.
I am not sure whether it's my fault or the pretrained model is not the best one ;-)
Br,
Tim
landmark的groundtruth的生成方式和论文不一致?
Hi, you say achieve the better result than the original acc in this repo,
( yours: 0.9206 | 0.9089 | 0.7846 papers: 0.922 | 0.911 | 0.782 )
but I found that you use a IoU thr=0.4 when you compute the final mAP, which is wrong because original matlab eval tool use a IoU thr=0.5, and that's the reason why you got the above performance.
So I don't think it's a fair comparison. Can you explain this? Thx.
Hi Sir:
when converting to onnx, got the error:
"RuntimeError: Only tuples, lists and Variables supported as JIT inputs, but got dict"
could you figure it out?
many thanks.
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.