TreB1eN / InsightFace_Pytorch

Pytorch0.4.1 codes for InsightFace
MIT License
1.74k stars 423 forks source link

Problem met when runing `try_mtcnn_step_by_step.ipynb` #88

Open NarcissusInMirror opened 5 years ago

NarcissusInMirror commented 5 years ago

I met a very weird problem when I running the code!

When I run try_mtcnn_step_by_step.ipynb first couple of times, there are totally no errors, and I tested it on several images in my own phone, it works well and at the first step, the pnet will detect about thousands of bounding box and finally did a great work on detecting faces. But just a few hours later when I try to run it again, I got error messages that told me can't find the weights of pnet, which is located in /InsightFace_Pytorch-master/mtcnn_pytorch/src/weights/pnet.npy.

I read the code and find that the weights is loaded in /InsightFace_Pytorch-master/mtcnn_pytorch/src/get_nets.py, and the original code is

weights = np.load('mtcnn_pytorch/src/weights/rnet.npy')[()]

for the try_mtcnn_step_by_step.ipynb is in /mtcnn_pytorch/, I changed the path into

weights = np.load('src/weights/rnet.npy')[()]

and after that the code can be run normally. However, there are only 4 bounding box generated after the pnet, totally different from the previous situation. When I run the infer_on_video.py, it return the same result, each frame only generate no more than 10 bounding box after the pnet.

I feel so confused and can't figure out why it is happening. I downloaded the repository and ran the code again but nothing changed. What's more confusing is that why I can ran the code successfully at the first place.

Is there anybody met the same problem as me? I really can't figure out what goes wrong...

NarcissusInMirror commented 5 years ago

I may have found where the problem is. I got the expected results under the mtcnn-pytorch directory which I downloaded by using command git clone https://github.com/TropComplique/mtcnn-pytorch.git, and got the bad result under the InsightFace_Pytorch-master/mtcnn_pytorch/ directory which is the whole repository i downloaded directly clicked on 'download zip' button, I confused these two folders.

It seems that the codes acquired are different using above two different ways.