You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Under low light conditions this would result in same image contrast as with bright images as you remove the average image intensity and divide by the average fluctuations in the image.
However both Stansilas and you define pixel means to be 0 and stds to be 1 and you don't compute them for each image.
Basically your code subtracts 0 and divides each pixel by 1 which is unnecessary.
If people want to use retinaface on dark images it might be useful to provide option to compute means with np.mean(image) and np.std(image).
I understand your code is based Stanislas Bertrand's but please take a look at the following line in the preprocessor:
im_tensor[0, :, :, i] = (img[:, :, 2 - i] / pixel_scale - pixel_means[2 - i]) / pixel_stds[2 - i]
Under low light conditions this would result in same image contrast as with bright images as you remove the average image intensity and divide by the average fluctuations in the image.
However both Stansilas and you define pixel means to be 0 and stds to be 1 and you don't compute them for each image.
Basically your code subtracts 0 and divides each pixel by 1 which is unnecessary.
If people want to use retinaface on dark images it might be useful to provide option to compute means with np.mean(image) and np.std(image).
Simplified preprocessor:
def preprocess_image(img, allow_upscaling):
scales = [1024, 1980]
img, img_scale = resize_image(img, scales, allow_upscaling)
img = img.astype(np.float32)
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img_tensor = np.expand_dims(img_rgb, axis=0)
return img_tensor, img.shape[0:2], img_scale
Unfortunately most of computation time is used in the tensor computation and this changes has little impact on performance.
The text was updated successfully, but these errors were encountered: