Giter Site home page Giter Site logo

kuaikuaikim / dface Goto Github PK

View Code? Open in Web Editor NEW
1.2K 67.0 345.0 3.76 MB

Deep learning face detection and recognition, implemented by pytorch. (pytorch实现的人脸检测和人脸识别)

Home Page: http://dface.tech

License: Apache License 2.0

Python 100.00%
facedetection facerecognition deeplearning pytorch mtcnn mtcnn-pytorch

dface's People

Contributors

coscubes avatar imsatoshi avatar kuaikuaikim avatar sdumzg 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  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

dface's Issues

loss function

Thank you for your attention. I didn't understand this loss function. Can you give me a analysis?

def box_loss(self,gt_label,gt_offset,pred_offset):
pred_offset = torch.squeeze(pred_offset)
gt_offset = torch.squeeze(gt_offset)
gt_label = torch.squeeze(gt_label)

    #get the mask element which != 0
    unmask = torch.eq(gt_label,0)
    mask = torch.eq(unmask,0)
    #convert mask to dim index
    chose_index = torch.nonzero(mask.data)
    chose_index = torch.squeeze(chose_index)
    #only valid element can effect the loss
    valid_gt_offset = gt_offset[chose_index,:]
    valid_pred_offset = pred_offset[chose_index,:]
    return self.loss_box(valid_pred_offset,valid_gt_offset)*self.box_factor

RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight'

你好,我在跑test_image.py时遇到这个问题
RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight',
打印如下:
Traceback (most recent call last):
File "E:/Code/MachineLearning/DFace-master/test_image.py", line 18, in
bboxs, landmarks = mtcnn_detector.detect_face(img)
File "E:\Code\MachineLearning\DFace-master\dface\core\detect.py", line 610, in detect_face
boxes, boxes_align = self.detect_pnet(img)
File "E:\Code\MachineLearning\DFace-master\dface\core\detect.py", line 271, in detect_pnet
cls_map, reg = self.pnet_detector(feed_imgs)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "E:\Code\MachineLearning\DFace-master\dface\core\models.py", line 97, in forward
x = self.pre_layer(x)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\container.py", line 92, in forward
input = module(input)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 343, in forward
return self.conv2d_forward(input, self.weight)
File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 340, in conv2d_forward
self.padding, self.dilation, self.groups)
RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight'

Process finished with exit code 1

有朋友遇到类似问题么?感谢!

TypeError in gen_Pnet_train_data.py

12880 pics in total
Traceback (most recent call last):
  File "dface/prepare_data/gen_Pnet_train_data.py", line 175, in <module>
    gen_pnet_data(args.traindata_store,args.annotation_file,args.prefix_path)
  File "dface/prepare_data/gen_Pnet_train_data.py", line 133, in gen_pnet_data
    cropped_im = img[ny1 : ny2, nx1 : nx2, :]
TypeError: slice indices must be integers or None or have an __index__ method

The problem is that the n** are not int. Is it safe to simply do:

cropped_im = img[int(ny1) : int(ny2), int(nx1) : int(nx2), :]

?
I'm using python 3.6

face Anti-Spoofing

关于人脸识别防照片欺诈这方面,请问一下您有什么比较好的思路吗?我最近就在做这方面的工作,只是苦于没有切入点,网上也没搜索到可以用的算法,自己能力有限也写不出来,不知道您有没有什么好的想法可以分享一下,如果我能实现而且效果还可以,我可以把代码直接分享出来。

Error in gen_Onet_train_data.py

It gave error from negative dimension, I try to find the value and it's -1, not sure where it came from

~/DFace/dface/core/detect.py in detect_rnet(self, im, dets)
389 for i in range(num_boxes):
--> 390 tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
391 tmp[dy[i]:edy[i]+1, dx[i]:edx[i]+1, :] = im[y[i]:ey[i]+1, x[i]:ex[i]+1, :]
392 crop_im = cv2.resize(tmp, (24, 24))

ValueError: negative dimensions are not allowed

bbox loss激增问题

我在训练r_net的时候bbox loss突然变得很大,请问有其他人遇到类似问题吗
train Rnet argument:
Namespace(annotation_file='/app/ljn_work/DFace/anno_store/imglist_anno_24.txt', batch_size=512, end_epoch=22, frequent=200, lr=0.01, model_store_path='/app/ljn_work/DFace/model_store', use_cuda=True, **{'': None})
append flipped images to imdb 824034
../core/models.py:8: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
nn.init.xavier_uniform(m.weight.data)
../core/models.py:9: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_.
nn.init.constant(m.bias, 0.1)
2019-01-23 14:21:15.507047 : Epoch: 1, Step: 0, accuracy: 0.9690722227096558, det loss: 0.5977954864501953, bbox loss: 0.1574765294790268, all_loss: 0.6765337586402893, lr:0.01
2019-01-23 14:22:00.736671 : Epoch: 1, Step: 200, accuracy: 0.9730290770530701, det loss: 0.11306899785995483, bbox loss: 0.023932723328471184, all_loss: 0.125035360455513, lr:0.01
2019-01-23 14:22:44.877566 : Epoch: 1, Step: 400, accuracy: 0.9812500476837158, det loss: 0.06650176644325256, bbox loss: 0.03081391006708145, all_loss: 0.08190871775150299, lr:0.01
2019-01-23 14:23:23.430212 : Epoch: 1, Step: 600, accuracy: 0.9613820910453796, det loss: 0.10355271399021149, bbox loss: 0.028969649225473404, all_loss: 0.11803753674030304, lr:0.01
2019-01-23 14:24:00.741899 : Epoch: 1, Step: 800, accuracy: 0.9894291758537292, det loss: 0.05135280638933182, bbox loss: 0.027542466297745705, all_loss: 0.0651240423321724, lr:0.01
2019-01-23 14:24:37.632884 : Epoch: 1, Step: 1000, accuracy: 0.9835051894187927, det loss: 0.05876293033361435, bbox loss: 0.019213180989027023, all_loss: 0.06836952269077301, lr:0.01
2019-01-23 14:25:11.963026 : Epoch: 1, Step: 1200, accuracy: 0.9896907806396484, det loss: 0.06266145408153534, bbox loss: 0.0241145770996809, all_loss: 0.07471874356269836, lr:0.01
2019-01-23 14:25:45.191520 : Epoch: 1, Step: 1400, accuracy: 0.9833679795265198, det loss: 0.06828348338603973, bbox loss: 0.027324318885803223, all_loss: 0.08194564282894135, lr:0.01
2019-01-23 14:26:12.594181 : Epoch: 1, Step: 1600, accuracy: 0.9831578731536865, det loss: 0.08070078492164612, bbox loss: 0.026685547083616257, all_loss: 0.0940435603260994, lr:0.01
2019-01-23 14:26:41.969361 : Epoch: 1, Step: 1800, accuracy: 0.9835051894187927, det loss: 0.06561711430549622, bbox loss: 0.02304217964410782, all_loss: 0.07713820040225983, lr:0.01
2019-01-23 14:27:06.414403 : Epoch: 1, Step: 2000, accuracy: 0.9767932295799255, det loss: 0.09401784837245941, bbox loss: 0.023107564076781273, all_loss: 0.10557162761688232, lr:0.01
2019-01-23 14:27:29.553256 : Epoch: 1, Step: 2200, accuracy: 0.9832635521888733, det loss: 0.054206281900405884, bbox loss: 0.0239733774214983, all_loss: 0.06619296967983246, lr:0.01
2019-01-23 14:27:53.957669 : Epoch: 1, Step: 2400, accuracy: 0.9854772090911865, det loss: 0.047386255115270615, bbox loss: 0.023768266662955284, all_loss: 0.05927038937807083, lr:0.01
2019-01-23 14:28:15.802341 : Epoch: 1, Step: 2600, accuracy: 0.9852631092071533, det loss: 0.0627639964222908, bbox loss: 0.023052219301462173, all_loss: 0.07429010421037674, lr:0.01
2019-01-23 14:28:37.131607 : Epoch: 1, Step: 2800, accuracy: 0.9853556156158447, det loss: 0.04311512038111687, bbox loss: 0.0205087848007679, all_loss: 0.053369514644145966, lr:0.01
2019-01-23 14:28:56.894010 : Epoch: 1, Step: 3000, accuracy: 0.9937106370925903, det loss: 0.033722564578056335, bbox loss: 0.025765910744667053, all_loss: 0.04660551995038986, lr:0.01
2019-01-23 14:29:15.391435 : Epoch: 1, Step: 3200, accuracy: 0.9895616173744202, det loss: 0.044307757169008255, bbox loss: 0.020762424916028976, all_loss: 0.054688967764377594, lr:0.01
Epoch: 1, accuracy: 0.9821656346321106, cls loss: 0.09693042933940887, bbox loss: 0.03235609456896782
2019-01-23 14:29:17.076650 : Epoch: 2, Step: 0, accuracy: 0.9917526245117188, det loss: 0.017674211412668228, bbox loss: 0.027816535905003548, all_loss: 0.03158247843384743, lr:0.01
2019-01-23 14:29:34.908802 : Epoch: 2, Step: 200, accuracy: 0.9853862524032593, det loss: 0.04590099677443504, bbox loss: 0.026683641597628593, all_loss: 0.059242818504571915, lr:0.01
2019-01-23 14:29:54.435913 : Epoch: 2, Step: 400, accuracy: 0.9690722227096558, det loss: 0.11844029277563095, bbox loss: 0.017504854127764702, all_loss: 0.12719272077083588, lr:0.01
2019-01-23 14:30:12.778035 : Epoch: 2, Step: 600, accuracy: 0.9917355179786682, det loss: 0.03938473388552666, bbox loss: 0.017851099371910095, all_loss: 0.048310283571481705, lr:0.01
2019-01-23 14:30:30.442959 : Epoch: 2, Step: 800, accuracy: 0.9873417019844055, det loss: 0.0521685853600502, bbox loss: 0.02776484563946724, all_loss: 0.06605100631713867, lr:0.01
2019-01-23 14:30:48.199636 : Epoch: 2, Step: 1000, accuracy: 0.9792531728744507, det loss: 0.0700664296746254, bbox loss: 0.03486182913184166, all_loss: 0.08749734610319138, lr:0.01
2019-01-23 14:31:06.811424 : Epoch: 2, Step: 1200, accuracy: 0.9812108874320984, det loss: 0.051916588097810745, bbox loss: 0.03027299977838993, all_loss: 0.06705308705568314, lr:0.01
2019-01-23 14:31:24.524263 : Epoch: 2, Step: 1400, accuracy: 0.9917184710502625, det loss: 0.042696353048086166, bbox loss: 0.02568719908595085, all_loss: 0.05553995072841644, lr:0.01
2019-01-23 14:31:42.106860 : Epoch: 2, Step: 1600, accuracy: 0.9894958734512329, det loss: 0.05638515576720238, bbox loss: 0.029507212340831757, all_loss: 0.07113876193761826, lr:0.01
2019-01-23 14:32:01.420803 : Epoch: 2, Step: 1800, accuracy: 0.9874476790428162, det loss: 0.04238443076610565, bbox loss: 0.030263887718319893, all_loss: 0.057516373693943024, lr:0.01
2019-01-23 14:32:20.253376 : Epoch: 2, Step: 2000, accuracy: 0.9812889695167542, det loss: 0.060417406260967255, bbox loss: 0.026619980111718178, all_loss: 0.07372739911079407, lr:0.01
2019-01-23 14:32:38.544129 : Epoch: 2, Step: 2200, accuracy: 0.9733605980873108, det loss: 0.7360723614692688, bbox loss: 51090.0234375, all_loss: 25545.748046875, lr:0.01
2019-01-23 14:32:56.030824 : Epoch: 2, Step: 2400, accuracy: 0.9766454696655273, det loss: 0.6453104615211487, bbox loss: 30.824626922607422, all_loss: 16.05762481689453, lr:0.01
2019-01-23 14:33:13.531097 : Epoch: 2, Step: 2600, accuracy: 0.9664570093154907, det loss: 0.9268267154693604, bbox loss: 19.710317611694336, all_loss: 10.78198528289795, lr:0.01
2019-01-23 14:33:31.707023 : Epoch: 2, Step: 2800, accuracy: 0.9897958636283875, det loss: 0.2819491922855377, bbox loss: 12.830120086669922, all_loss: 6.697009086608887, lr:0.01
2019-01-23 14:33:49.352857 : Epoch: 2, Step: 3000, accuracy: 0.958071231842041, det loss: 1.1585333347320557, bbox loss: 9.914958000183105, all_loss: 6.1160125732421875, lr:0.01
2019-01-23 14:34:07.073843 : Epoch: 2, Step: 3200, accuracy: 0.9707112908363342, det loss: 0.8092767596244812, bbox loss: 8.420356750488281, all_loss: 5.0194549560546875, lr:0.01
Epoch: 2, accuracy: 0.9806320071220398, cls loss: 0.30325907468795776, bbox loss: 3010.118896484375
2019-01-23 14:34:08.732263 : Epoch: 3, Step: 0, accuracy: 0.95208340883255, det loss: 1.3239864110946655, bbox loss: 8.500407218933105, all_loss: 5.574190139770508, lr:0.01
2019-01-23 14:34:27.355744 : Epoch: 3, Step: 200, accuracy: 0.9832285046577454, det loss: 0.4634133577346802, bbox loss: 5.173794746398926, all_loss: 3.0503106117248535, lr:0.01
2019-01-23 14:34:44.825701 : Epoch: 3, Step: 400, accuracy: 0.9689441323280334, det loss: 0.8581061959266663, bbox loss: 4.081416130065918, all_loss: 2.8988142013549805, lr:0.01
2019-01-23 14:35:02.375759 : Epoch: 3, Step: 600, accuracy: 0.970954418182373, det loss: 0.8025608658790588, bbox loss: 6.820148944854736, all_loss: 4.212635517120361, lr:0.01
2019-01-23 14:35:20.082355 : Epoch: 3, Step: 800, accuracy: 0.9731959104537964, det loss: 0.7406253814697266, bbox loss: 2.788095474243164, all_loss: 2.1346731185913086, lr:0.01
2019-01-23 14:35:37.779874 : Epoch: 3, Step: 1000, accuracy: 0.9753085970878601, det loss: 0.6822474598884583, bbox loss: 4.362936019897461, all_loss: 2.863715410232544, lr:0.01
2019-01-23 14:35:55.549916 : Epoch: 3, Step: 1200, accuracy: 0.9730849266052246, det loss: 0.7436921000480652, bbox loss: 2.563908100128174, all_loss: 2.025646209716797, lr:0.01
2019-01-23 14:36:13.278228 : Epoch: 3, Step: 1400, accuracy: 0.9568789005279541, det loss: 1.1914814710617065, bbox loss: 2.419104814529419, all_loss: 2.401033878326416, lr:0.01
2019-01-23 14:36:30.979793 : Epoch: 3, Step: 1600, accuracy: 0.9684209823608398, det loss: 0.8725585341453552, bbox loss: 4.835862159729004, all_loss: 3.290489673614502, lr:0.01
2019-01-23 14:36:48.621762 : Epoch: 3, Step: 1800, accuracy: 0.9569671750068665, det loss: 1.1890400648117065, bbox loss: 8.744510650634766, all_loss: 5.561295509338379, lr:0.01
2019-01-23 14:37:06.089376 : Epoch: 3, Step: 2000, accuracy: 0.9728601574897766, det loss: 0.7499024868011475, bbox loss: 2.765618324279785, all_loss: 2.13271164894104, lr:0.01
2019-01-23 14:37:23.618019 : Epoch: 3, Step: 2200, accuracy: 0.9752065539360046, det loss: 0.6850666403770447, bbox loss: 5.427116394042969, all_loss: 3.398624897003174, lr:0.01
2019-01-23 14:37:41.202316 : Epoch: 3, Step: 2400, accuracy: 0.9769391417503357, det loss: 0.6371933221817017, bbox loss: 5.064423084259033, all_loss: 3.169404983520508, lr:0.01
2019-01-23 14:37:59.325220 : Epoch: 3, Step: 2600, accuracy: 0.9734693169593811, det loss: 0.7330679297447205, bbox loss: 2.8945021629333496, all_loss: 2.18031907081604, lr:0.01
2019-01-23 14:38:17.459984 : Epoch: 3, Step: 2800, accuracy: 0.9732509851455688, det loss: 0.7391014099121094, bbox loss: 11.652641296386719, all_loss: 6.565422058105469, lr:0.01
2019-01-23 14:38:35.265657 : Epoch: 3, Step: 3000, accuracy: 0.9793815016746521, det loss: 0.5697118043899536, bbox loss: 6.923870086669922, all_loss: 4.031646728515625, lr:0.01
2019-01-23 14:38:52.865394 : Epoch: 3, Step: 3200, accuracy: 0.9728601574897766, det loss: 0.7499023675918579, bbox loss: 1.9425570964813232, all_loss: 1.7211809158325195, lr:0.01
Epoch: 3, accuracy: 0.9707667231559753, cls loss: 0.807744562625885, bbox loss: 5.115347862243652
2019-01-23 14:38:54.500485 : Epoch: 4, Step: 0, accuracy: 0.9523809552192688, det loss: 1.3157627582550049, bbox loss: 1.4270354509353638, all_loss: 2.029280424118042, lr:0.01
2019-01-23 14:39:12.029839 : Epoch: 4, Step: 200, accuracy: 0.9629629254341125, det loss: 1.0233712196350098, bbox loss: 0.9527443051338196, all_loss: 1.4997433423995972, lr:0.01
2019-01-23 14:39:29.662662 : Epoch: 4, Step: 400, accuracy: 0.970954418182373, det loss: 0.8025607466697693, bbox loss: 3.181978464126587, all_loss: 2.393549919128418, lr:0.01
2019-01-23 14:39:47.202199 : Epoch: 4, Step: 600, accuracy: 0.9764453768730164, det loss: 0.6508377194404602, bbox loss: 10.882843017578125, all_loss: 6.092259407043457, lr:0.01
2019-01-23 14:40:05.007325 : Epoch: 4, Step: 800, accuracy: 0.9690722227096558, det loss: 0.8545677065849304, bbox loss: 0.8961852192878723, all_loss: 1.302660346031189, lr:0.01
2019-01-23 14:40:22.690702 : Epoch: 4, Step: 1000, accuracy: 0.9680171012878418, det loss: 0.8837214112281799, bbox loss: 1.7729414701461792, all_loss: 1.7701921463012695, lr:0.01
2019-01-23 14:40:40.455843 : Epoch: 4, Step: 1200, accuracy: 0.9813664555549622, det loss: 0.5148637890815735, bbox loss: 11.610335350036621, all_loss: 6.320031642913818, lr:0.01
2019-01-23 14:40:58.200712 : Epoch: 4, Step: 1400, accuracy: 0.9712526202201843, det loss: 0.7943210005760193, bbox loss: 2.4853084087371826, all_loss: 2.036975145339966, lr:0.01
2019-01-23 14:41:15.930705 : Epoch: 4, Step: 1600, accuracy: 0.9689441323280334, det loss: 0.858106255531311, bbox loss: 0.6418619155883789, all_loss: 1.1790372133255005, lr:0.01
2019-01-23 14:41:33.608430 : Epoch: 4, Step: 1800, accuracy: 0.9769874215126038, det loss: 0.6358603239059448, bbox loss: 0.512661337852478, all_loss: 0.8921909928321838, lr:0.01
2019-01-23 14:41:51.154037 : Epoch: 4, Step: 2000, accuracy: 0.9790794849395752, det loss: 0.5780549049377441, bbox loss: 40.10780334472656, all_loss: 20.631956100463867, lr:0.01
2019-01-23 14:42:08.722124 : Epoch: 4, Step: 2200, accuracy: 0.975051999092102, det loss: 0.6893393397331238, bbox loss: 1.4536627531051636, all_loss: 1.4161707162857056, lr:0.01
2019-01-23 14:42:26.425914 : Epoch: 4, Step: 2400, accuracy: 0.9730290770530701, det loss: 0.745235025882721, bbox loss: 0.9394894242286682, all_loss: 1.2149797677993774, lr:0.01
2019-01-23 14:42:43.953294 : Epoch: 4, Step: 2600, accuracy: 0.9667359590530396, det loss: 0.9191191792488098, bbox loss: 1.7752183675765991, all_loss: 1.8067283630371094, lr:0.01
2019-01-23 14:43:01.647522 : Epoch: 4, Step: 2800, accuracy: 0.9771784543991089, det loss: 0.6305834650993347, bbox loss: 0.3447815477848053, all_loss: 0.8029742240905762, lr:0.01
2019-01-23 14:43:19.346791 : Epoch: 4, Step: 3000, accuracy: 0.9688149690628052, det loss: 0.8616742491722107, bbox loss: 0.2147742360830307, all_loss: 0.9690613746643066, lr:0.01
2019-01-23 14:43:37.291739 : Epoch: 4, Step: 3200, accuracy: 0.966386616230011, det loss: 0.928773820400238, bbox loss: 10.592591285705566, all_loss: 6.225069522857666, lr:0.01
Epoch: 4, accuracy: 0.9708623290061951, cls loss: 0.8051031231880188, bbox loss: 5.281894683837891
2019-01-23 14:43:39.106912 : Epoch: 5, Step: 0, accuracy: 0.9645833969116211, det loss: 0.9785986542701721, bbox loss: 1.4899259805679321, all_loss: 1.7235616445541382, lr:0.01
2019-01-23 14:43:58.427369 : Epoch: 5, Step: 200, accuracy: 0.9628098607063293, det loss: 1.0276000499725342, bbox loss: 77.7536392211914, all_loss: 39.9044189453125, lr:0.01
2019-01-23 14:44:16.214350 : Epoch: 5, Step: 400, accuracy: 0.9744136929512024, det loss: 0.706977128982544, bbox loss: 54.73612976074219, all_loss: 28.075042724609375, lr:0.01
2019-01-23 14:44:34.805013 : Epoch: 5, Step: 600, accuracy: 0.9648759961128235, det loss: 0.9705110788345337, bbox loss: 52.41902542114258, all_loss: 27.180023193359375, lr:0.01
2019-01-23 14:44:53.576852 : Epoch: 5, Step: 800, accuracy: 0.9708333611488342, det loss: 0.8059048056602478, bbox loss: 30.6917667388916, all_loss: 16.15178871154785, lr:0.01
2019-01-23 14:45:11.230668 : Epoch: 5, Step: 1000, accuracy: 0.9670103192329407, det loss: 0.9115387797355652, bbox loss: 43.69115447998047, all_loss: 22.757116317749023, lr:0.01
2019-01-23 14:45:28.921397 : Epoch: 5, Step: 1200, accuracy: 0.9648033380508423, det loss: 0.9725204110145569, bbox loss: 23.02033805847168, all_loss: 12.48268985748291, lr:0.01
2019-01-23 14:45:47.105647 : Epoch: 5, Step: 1400, accuracy: 0.9775509834289551, det loss: 0.6202881932258606, bbox loss: 29.870832443237305, all_loss: 15.555704116821289, lr:0.01
2019-01-23 14:46:05.092484 : Epoch: 5, Step: 1600, accuracy: 0.9722814559936523, det loss: 0.7658918499946594, bbox loss: 17.052854537963867, all_loss: 9.292319297790527, lr:0.01
2019-01-23 14:46:23.110959 : Epoch: 5, Step: 1800, accuracy: 0.9728601574897766, det loss: 0.7499023675918579, bbox loss: 12.887855529785156, all_loss: 7.1938300132751465, lr:0.01
2019-01-23 14:46:40.897368 : Epoch: 5, Step: 2000, accuracy: 0.970954418182373, det loss: 0.8025608062744141, bbox loss: 10.125185012817383, all_loss: 5.8651533126831055, lr:0.01
2019-01-23 14:46:58.737332 : Epoch: 5, Step: 2200, accuracy: 0.9689441323280334, det loss: 0.858106255531311, bbox loss: 10.612981796264648, all_loss: 6.164597034454346, lr:0.01
2019-01-23 14:47:16.662478 : Epoch: 5, Step: 2400, accuracy: 0.9579832553863525, det loss: 1.160967230796814, bbox loss: 7.97253942489624, all_loss: 5.1472368240356445, lr:0.01
2019-01-23 14:47:34.737180 : Epoch: 5, Step: 2600, accuracy: 0.9834368824958801, det loss: 0.45765671133995056, bbox loss: 5.740257263183594, all_loss: 3.3277852535247803, lr:0.01
2019-01-23 14:47:52.946507 : Epoch: 5, Step: 2800, accuracy: 0.9614561200141907, det loss: 1.065007209777832, bbox loss: 8.753331184387207, all_loss: 5.4416728019714355, lr:0.01
2019-01-23 14:48:12.018501 : Epoch: 5, Step: 3000, accuracy: 0.9708939790725708, det loss: 0.8042293190956116, bbox loss: 10.31871509552002, all_loss: 5.963586807250977, lr:0.01
2019-01-23 14:48:30.444587 : Epoch: 5, Step: 3200, accuracy: 0.9701492786407471, det loss: 0.8248065710067749, bbox loss: 9.488470077514648, all_loss: 5.569041728973389, lr:0.01
Epoch: 5, accuracy: 0.969167172908783, cls loss: 0.851945161819458, bbox loss: 23.91911506652832
2019-01-23 14:48:32.246242 : Epoch: 6, Step: 0, accuracy: 0.9649484753608704, det loss: 0.968510091304779, bbox loss: 8.402690887451172, all_loss: 5.16985559463501, lr:0.01
2019-01-23 14:48:51.166888 : Epoch: 6, Step: 200, accuracy: 0.9625779986381531, det loss: 1.0340090990066528, bbox loss: 4.893960952758789, all_loss: 3.480989456176758, lr:0.01
2019-01-23 14:49:09.799202 : Epoch: 6, Step: 400, accuracy: 0.9445585608482361, det loss: 1.5319045782089233, bbox loss: 6.67972993850708, all_loss: 4.871769428253174, lr:0.01
2019-01-23 14:49:27.814443 : Epoch: 6, Step: 600, accuracy: 0.9708939790725708, det loss: 0.8042293787002563, bbox loss: 5.477999687194824, all_loss: 3.543229103088379, lr:0.01
2019-01-23 14:49:45.420536 : Epoch: 6, Step: 800, accuracy: 0.9814814329147339, det loss: 0.5116856098175049, bbox loss: 4.063371658325195, all_loss: 2.5433714389801025, lr:0.01
2019-01-23 14:50:02.968040 : Epoch: 6, Step: 1000, accuracy: 0.9707724452018738, det loss: 0.8075873255729675, bbox loss: 11.518770217895508, all_loss: 6.566972255706787, lr:0.01
2019-01-23 14:50:20.716327 : Epoch: 6, Step: 1200, accuracy: 0.9708333611488342, det loss: 0.805904746055603, bbox loss: 2.895217180252075, all_loss: 2.2535133361816406, lr:0.01
2019-01-23 14:50:38.586131 : Epoch: 6, Step: 1400, accuracy: 0.9749478101730347, det loss: 0.6922176480293274, bbox loss: 38.158931732177734, all_loss: 19.771682739257812, lr:0.01
2019-01-23 14:50:56.286343 : Epoch: 6, Step: 1600, accuracy: 0.9744136929512024, det loss: 0.706977128982544, bbox loss: 23.079925537109375, all_loss: 12.246939659118652, lr:0.01
2019-01-23 14:51:13.872885 : Epoch: 6, Step: 1800, accuracy: 0.9686192274093628, det loss: 0.8670822381973267, bbox loss: 4.911552429199219, all_loss: 3.3228583335876465, lr:0.01
2019-01-23 14:51:31.560673 : Epoch: 6, Step: 2000, accuracy: 0.9686847925186157, det loss: 0.8652721047401428, bbox loss: 2.223311185836792, all_loss: 1.9769277572631836, lr:0.01

Train pnet error

.\dface\core\models.py:9: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_.
nn.init.constant(m.bias, 0.1)
Traceback (most recent call last):
File "g:/mtcnn/dface/train_net/train_p_net.py", line 92, in
use_cuda=args.use_cuda)
File "g:/mtcnn/dface/train_net/train_p_net.py", line 30, in train_net
use_cuda=use_cuda)
File ".\dface\train_net\train.py", line 92, in train_pnet
show1 = accuracy.data.tolist()[0]
TypeError: 'float' object is not subscriptable

Expected object of type torch.DoubleTensor but found type torch.FloatTensor for argument #2 'weight'

when test the model ,got the issue as below ,plz help to check the issue

RuntimeError Traceback (most recent call last)
in ()
17
18 print("start to detect ")
---> 19 bboxs, landmarks = mtcnn_detector.detect_face(img)
20 # print box_align
21

~/jupyter/DFACE/DFace/dface/core/detect.py in detect_face(self, img)
612 # pnet
613 if self.pnet_detector:
--> 614 boxes, boxes_align = self.detect_pnet(img)
615 if boxes_align is None:
616 return np.array([]), np.array([])

~/jupyter/DFACE/DFace/dface/core/detect.py in detect_pnet(self, im)
269
270 print('type of feed_imgs:',type(feed_imgs))
--> 271 cls_map, reg = self.pnet_detector(feed_imgs)
272
273 cls_map_np = image_tools.convert_chwTensor_to_hwcNumpy(cls_map.cpu())

/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py in call(self, *input, **kwargs)
489 result = self._slow_forward(*input, **kwargs)
490 else:
--> 491 result = self.forward(*input, **kwargs)
492 for hook in self._forward_hooks.values():
493 hook_result = hook(self, input, result)

~/jupyter/DFACE/DFace/dface/core/models.py in forward(self, x)
95
96 def forward(self, x):
---> 97 x = self.pre_layer(x)
98 label = F.sigmoid(self.conv4_1(x))
99 offset = self.conv4_2(x)

ValueError: negative dimensions are not allowed

我的当前环境ubuntu16;

import torch
torch.version
'1.0.1.post2'
python -V
Python 2.7.12
以下是具体错误
python test_image.py
/opt/soft/dface/dface/core/models.py:8: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
nn.init.xavier_uniform(m.weight.data)
/opt/soft/dface/dface/core/models.py:9: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_.
nn.init.constant(m.bias, 0.1)
/usr/local/lib/python2.7/dist-packages/torch/nn/functional.py:1332: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
Traceback (most recent call last):
File "test_image.py", line 21, in
bboxs, landmarks = mtcnn_detector.detect_face(img)
File "/opt/soft/dface/dface/core/detect.py", line 619, in detect_face
boxes, boxes_align = self.detect_rnet(img, boxes_align)
File "/opt/soft/dface/dface/core/detect.py", line 391, in detect_rnet
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
ValueError: negative dimensions are not allowed

Runtime error:zero-dimensional tensor(at position 0) cannot be contatenated

when I run train_p_net.py ,it shows these error:
Traceback (most recent call last):
File "dface/train_net/train_p_net.py", line 50, in
end_epoch=args.end_epoch, frequent=args.frequent, lr=args.lr, batch_size=args.batch_size, use_cuda=args.use_cuda)
File "dface/train_net/train_p_net.py", line 17, in train_net
train_pnet(model_store_path=model_store_path, end_epoch=end_epoch, imdb=gt_imdb, batch_size=batch_size, frequent=frequent, base_lr=lr, use_cuda=use_cuda)
File "/home/li/DFace/dface/train_net/train.py", line 97, in train_pnet
accuracy_avg = torch.mean(torch.cat(accuracy_list))
RuntimeError: zero-dimensional tensor (at position 0) cannot be concatenated

example error

Hi
I run test_image.py and get the following error:

/home/aj/repo/DFace/dface/core/models.py:8: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
nn.init.xavier_uniform(m.weight.data)
/home/aj/repo/DFace/dface/core/models.py:9: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_.
nn.init.constant(m.bias, 0.1)
Traceback (most recent call last):
File "test_image.py", line 18, in
bboxs, landmarks = mtcnn_detector.detect_face(img)
File "/home/aj/repo/DFace/dface/core/detect.py", line 622, in detect_face
boxes, boxes_align = self.detect_rnet(img, boxes_align)
File "/home/aj/repo/DFace/dface/core/detect.py", line 391, in detect_rnet
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
ValueError: negative dimensions are not allowed

I use pytorch .4 and python 3.5

TypeError: float() argument must be a string or a number, not 'map'

When I run gen_Rnet_train_data.py, I meet this problem.

Traceback (most recent call last):
File " dface/ prepare. data/gen Rnet_ train_ data.py", line 216, in
gen_ rnet_ data( args. traindata_ store, args . annotation_ file, args . pnet_ model_ file, args.prefix_ path, args.use cuda
File "dface/prepare data/gen_ Rnet_ train_ data.py", line 61, in gen_ rnet data
gen_ rnet_ sample_ data(data_ dir , anno. file , save file ,prefix_ path)
File "dface/prepare data/gen_ Rnet_ train_ data.py", line 95, in gen. rnet sample data
boxes . np. array(boxes, dtype=np. float32).reshape(-1, 4)
TypeError: float() argunent nust be a string or a nunber, not 'map'1iat . InEo

Why plus 1 when calculating the box_area ?

In the file : dface/core/utils.py.IoU
box_area = (box[2] - box[0] + 1) * (box[3] - box[1] + 1)
area = (boxes[:, 2] - boxes[:, 0] + 1) * (boxes[:, 3] - boxes[:, 1] + 1)

Is there any tircks has been used when calculating the box_area ? why plus 1 ?

for example,the box[1, 1, 2, 2], the area should be 1, not (2-1+1) * (2-1+1) = 4 ?

PNET训练loss降到0.15左右不再下降问题

2018-09-13 10:26:48.499547 : Epoch: 2, Step: 1600, accuracy: tensor(0.9752), det loss: tensor(0.1310), bbox loss: tensor(1.00000e-02 *2.1214), all_loss: tensor(0.1416), lr:0.001

前辈,你好,我训练PNET,loss下降到0.15-0.16左右之后就不再下降了,一直在震荡,修改lr至0.001,改小batch_size到256也不下降了,想请教一下,你训练Pnet时loss能降到多少,能不能给点调参建议,谢谢

Which CelebA landmark TXT file to use in gen_landmark_48.py

There're 2 files to choose CelebA

Is it the one with align & cropped?

The landmark locations in "list_landmarks_align_celeba.txt" are based on the coordinates of align&cropped images.

Also, don't we have to call gen_landmark_12 and gen_landmark_24 after Pnet and Rnet gen data?

Package versions

Hello,

Can someone please let me know what versions of torch, torchvision, opencv and matplotlib worked for you?
The owner(s) of this repo have not provided adequate information regarding what versions they used to run this model in the requirements section.

Thanks in advance!

For gen_landmark_48.py, where does trainImageList.txt come from?

I couldn't figure out how to get gen_landmark_48.py to work with CelebA, so I used the the trainImageList from here: https://github.com/AITTSMD/MTCNN-Tensorflow/blob/master/prepare_data/trainImageList.txt

I also used the dataset that goes with it. When I then call gen_landmark_48.py, it only generates 18 landmark images, which seems like it is much fewer than it should be.

Where is the trainImageList.txt that you used to generate your models?

标签文件问题

你好,在原始的wider_face数据源下载下来的标签文件中,TXT里面的样本是按照单个样本多行存放的,但我看到你的TXT文件是一行就存放了整个样本所有信息,这个是你后来自己二次处理之后的吗

How long does it take to train RNet?

I am training R-Net model and it takes 2 hours to complete just a single step in an epoch which is too unusual for a small model like R-Net (I checked the code and found that the data loading was very slow)? So how long does it take you to complete a step in R-Net training? And do you have any recommendations for speeding up the dataloading?

Onet ValueError

File "dface/prepare_data/gen_landmark_48.py", line 156, in
gen_data(args.annotation_file, args.traindata_store, args.prefix_path)
File "dface/prepare_data/gen_landmark_48.py", line 84, in gen_data
delta_x = npr.randint(-w * 0.2, w * 0.2)
File "mtrand.pyx", line 992, in mtrand.RandomState.randint
ValueError: Range cannot be empty (low >= high) unless no samples are taken

训练速度很慢

训练数据6万张图片,batch size设置512,训练PNet,读取数据就花了4个小时。迭代速度 20step 耗时4分钟。这个在哪里可以改吗

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.