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

NWPU Dataset --- How to reproduce luminance level labels? #29

Open
genesis9329 opened this issue Mar 1, 2024 · 0 comments
Open

NWPU Dataset --- How to reproduce luminance level labels? #29

genesis9329 opened this issue Mar 1, 2024 · 0 comments

Comments

@genesis9329
Copy link

Could you share the official code about how to assign luminance level label, please?
I tried to reproduce luminance level label of 0113.jpg according to your paper:

import cv2
import numpy as np

img_path = "/home/datasets/NWPU-Crowd/images/0113.jpg"
img = cv2.imread(img_path) #shape=(H,W,C)

yuv = cv2.cvtColor(img, cv2.COLOR_BGR2YUV)
yuv_normalized = yuv.astype(np.float32)/255.0
lumin = np.mean(yuv_normalized[:,:,0])
if lumin <= 0.25:
    label = 0
elif lumin <= 0.5:
    label = 1
elif lumin <= 0.75:
    label = 2

print("lumin =", lumin)
print("label =", label)

the output is "lumin = 0.21811360026165477", which should be assigned label "0” according to the paper, but in train.txt, "1" is assigned to 0113.jpg.
And many other images have a similar problem, so I'm wondering whether my code is wrong or threshold settings are different.

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

1 participant