dangweili / pedestrian-attribute-recognition-pytorch

A simple baseline for pedestrian attribute recognition in surveillance scenarios
332 stars 80 forks source link

speed of the model #10

Closed lynnw123 closed 5 years ago

lynnw123 commented 5 years ago

Thanks for your great work, I trained a model using PETA datasets and tested the 35 pedestrian attributes using PA100k datasets. However, the speed I got is very slow (demo.py), only about 1.2FPS. Is this normal? any suggestions to improve efficiency, thanks!

dangweili commented 5 years ago

The test speed depends on the hardware and the backbone network. Here the backbone is Resnet50. Maybe you can use GPU or try other backbone networks to improve efficiency.

lynnw123 commented 5 years ago

Thanks for your reply, the hardware is GTX 1080ti, I will try other backbone networks, thanks!

lynnw123 commented 5 years ago

I tried other backbones like resnet34 and resnet101, and used the demo script in the repo, the speed is still very slow, about 2 fps in resnet34. I am just wondering what test speed you can get for the DeepMar model?

dangweili commented 5 years ago

I find that, for pytorch, if you test one image only once, it takes about 0.6 seconds. If you test for 100 times, it takes about 1.6 seconds. The platform is GeForce GTX TITAN X. I think the reason is that it need to apply for GPU memory in the first time in test stage, so it will take more times at first time. Once GPU memory has been applied, it will take less time for other tests.

Test only one image. t0 = time.time() score = model(img_var).data.cpu().numpy() t1 = time.time() print 'gpu takes %f seconds.'%(t1-t0)

Test for 100 times. t0 = time.time() for i in range(100): score = model(img_var).data.cpu().numpy() t1 = time.time() print 'gpu takes %f seconds.'%(t1-t0)

lynnw123 commented 5 years ago

Thanks very much for your reply, it takes total 0.782 seconds when testing the same image 100 times (test in a laptop GTX 1060).