Giter Club home page Giter Club logo

centerface.pytorch's People

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

centerface.pytorch's Issues

Question about the Model Size

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?

损失函数

请问总损失一直维持在2.2,是什么问题呢,参数改了调小了初始学习率,总损失应该维持在多少大小?

Train Parameters

你好,我想请问一下具体是在多少个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。

训练结果为
image

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

Annotation file

Hi, can you provide the annotation file again? It will help a lot, thx!

关于数据集的报错,没有找到train的dataset。

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'

loss出现NAN

使用最新的代码和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

About the model structure?

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 .

about the speed

I found the net speed is 40ms When I tested the model in my computer with dgx1080. Is this speed normal?

loss nan

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

Not able to download model weights

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?

Small size face keypoint detection

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?

why fine tuning with 800 works?

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?

训练过程中出现loss突然全部为null是怎么回事呢

您好,大神,训练过程中突然出现这个问题,怎么解决呢?
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

Error in tensorrt inference

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)

训练问题

我使用你的代码进行训练,但精度只有 0.78 0.77和0.58,请问一下,您是用了哪些技巧呢,谢谢

Accuracy Issue

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?

what do the different tasks mean?

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.

关于FPN的通道数

1.注意到您发布的模型中FPN通道数为64,而centerface中FPN的通道数为24。
2.您代码中的后处理用的nms是centernet中的pooling的方式,而centerface官方的代码中采用的是计算IOU的方式,请问您是否对这两种方式都进行测试过?是不是会对精度有一定影响呢?

validation

can you get me the annotation of the validation set. Thank you

预处理逻辑

感谢您的开源, 请问为何预处理要用复杂的warpAffine 直接使用resize_with_padding可以吗?我测了下发现结果差距很大,请问为什么要使用warpAffine做图片的预处理和结果的后处理。

请问一下为何ImportError: No module named detectors.detector_factory

直接进入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的时候又出问题。搞不清这个路径到底该如何导入了,感觉有点复杂。

环境配置问题

没有requirements.txt文件。用conda env create -f enviroment.yaml时也出现pip的问题
image

image process

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 ?

How to train a centerface with five landmarks?

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

方便再更新一下吗?谢谢!

Difference of results on WIDERFACE hard validation set

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.

my_own_result

I am not sure whether it's my fault or the pretrained model is not the best one ;-)

Br,
Tim

Performance question

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.

convert to onnx error

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.

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.