Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evaluate.py produces different results for demo.py? #23

Closed
junliang230 opened this issue Apr 10, 2019 · 2 comments
Closed

evaluate.py produces different results for demo.py? #23

junliang230 opened this issue Apr 10, 2019 · 2 comments

Comments

@junliang230
Copy link

Why does running demo. py and evalevaluate. py with the same data set produce different results?
could you explain it, thanks

@amoudgl
Copy link
Owner

amoudgl commented Apr 30, 2019

@breezelj Hi, thanks for pointing out the issue. I also noticed that there is minor difference between bounding boxes produced by evaluate.py and demo.py.

# OTB Man sequence 0002 result
69.457,46.669,26.011,39.444  # demo.py
69.459,46.294,26.026,39.786  # evaluate.py

I recently digged into this issue and found out that got10k toolkit (evaluate.py) uses PIL to read images. On the other hand, my demo.py script reads images using opencv. There is a slight difference between pixel values of opencv and PIL images, which leads to different results. The following script reproduces this fact:

import numpy as np
import cv2
from PIL import Image
path = 'data/OTB/Man/img/0001.jpg'
cv2_img = cv2.imread(path)
cv2_img = cv2.cvtColor(cv2_img, cv2.COLOR_BGR2RGB)
pil_img = Image.open(path)
pil_img = np.array(pil_img)
print((cv2_img == pil_img).all())  # False

demo.py yields exactly same results as evaluate.py if you replace these lines with:

img_prev = np.array(Image.open(frames[i]))
img_curr = np.array(Image.open(frames[i+1]))

@junliang230
Copy link
Author

very nice, thank you very much for detailed explanation

@amoudgl amoudgl closed this as completed May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants