Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

What is the FPS(testing speed)? #62

Open
sisrfeng opened this issue Mar 26, 2020 · 3 comments
Open

What is the FPS(testing speed)? #62

sisrfeng opened this issue Mar 26, 2020 · 3 comments

Comments

@sisrfeng
Copy link

Is darknet much faster than pytorch implementation?

While fps is 42 on the paper of gaussian yolov3(uses darknet), I get 10fps with pytorch_GaussianYOLOv3 https://github.com/motokimura/PyTorch_Gaussian_YOLOv3
(forked from this repo) using Tesla M60, image size=1600x1200.
Testing on the 416x416 imgs, fps=21.

I save the resized image by addingcv2.imgwrite('myname',img)after img, info_img = preprocess(img, imgsize, jitter=0) # info = (h, w, nh, nw, dx, dy) in:

img = cv2.imread(image_path)
        #Preprocess image
img_raw = img.copy()[:, :, ::-1].transpose((2, 0, 1))
img, info_img = preprocess(img, imgsize, jitter=0)  # info = (h, w, nh, nw, dx, dy)
img = np.transpose(img / 255., (2, 0, 1))
img = torch.from_numpy(img).float().unsqueeze(0)

if gpu >= 0:
    # Send model to GPU
    img = Variable(img.type(torch.cuda.FloatTensor))
else:
    img = Variable(img.type(torch.FloatTensor))
@hirotomusiker
Copy link
Contributor

I did not put FPS performance results on README because the frame rate performance largely depends on :

  • Hardware (GPU, CPU)
  • Cuda and CuDNN versions
  • PyTorch and other package versions
  • preprocess and postprocess
    The papers usually don't disclose all the conditions on which their benchmark was done.

But as long as I see your code, preprocessing to re-size your large image and imwrite (if you do that every frame) should be slow. I recommend you to perform only the forward process on GPU and measure the inference speed firstly.

Thank you!

@sisrfeng
Copy link
Author

sisrfeng commented Mar 26, 2020

Thanks a lot!
If I feed 1600x1200 imgs to pytorch_GaussianYOLOv3 , I get 10 fps (the time includes preprossing)
Then I re-size 1600x1200 imgs to 416x416 and imwrite. The original code after imwrite is commented:

img = np.transpose(img / 255., (2, 0, 1))
img = torch.from_numpy(img).float().unsqueeze(0)

if gpu >= 0:
    # Send model to GPU
    img = Variable(img.type(torch.cuda.FloatTensor))
else:
    img = Variable(img.type(torch.FloatTensor))

If I feed 416x416 imgs to pytorch_GaussianYOLOv3, I get 21 fps.

Which of these two types of FPS is usually mentioned on the papers?

@hirotomusiker
Copy link
Contributor

hirotomusiker commented Mar 26, 2020

I'm not sure but in the following code they measure fps including pre-process.
https://github.com/pjreddie/darknet/blob/master/src/demo.c

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants