afm-shahab-uddin / SaliencyMix

SaliencyMix: A Saliency Guided Data Augmentation Strategy for Better Regularization
45 stars 13 forks source link

Quality of saliency detector #1

Open doublejtoh opened 3 years ago

doublejtoh commented 3 years ago

Regarding the saliency detector which you employed (cv2.StaticSaliencyFineGrained_create), it seems not well-performing for generating the saliency map. I overlayed the original image with the saliency map generated from above saliency detector as below: image

it just shows noisy artifacts. Are there additional treatments to be dealt with to remove these noises??

FYI, another saliency detector (cv2.StaticSaliencySpectralResidual_create) generates quite good saliency map as below:

image

p.s. Long time no see!

starpiens commented 1 year ago

This is a bug.

OpenCV's saliency detector expects images to be typed as uint8, but the images are floats in the authors' implementation. So the images need to be normalized (0-255) and be changed to uint8 before calling computeSaliency():

img_arr = image.numpy().transpose(1, 2, 0)
img_arr = (img_arr - img_arr.min()) / (img_arr.max() - img_arr.min())
img_arr = (img_arr * 255).astype(np.uint8)
success, salmap = self.saliency_computer.computeSaliency(img_arr)

Full code here

Gullesh commented 12 months ago

This is a bug.

OpenCV's saliency detector expects images to be typed as uint8, but the images are floats in the authors' implementation. So the images need to be normalized (0-255) and be changed to uint8 before calling computeSaliency():

img_arr = image.numpy().transpose(1, 2, 0)
img_arr = (img_arr - img_arr.min()) / (img_arr.max() - img_arr.min())
img_arr = (img_arr * 255).astype(np.uint8)
success, salmap = self.saliency_computer.computeSaliency(img_arr)

Full code here

Considering this bug, then the box of salient region the SaliencyMix finds are totally random then.