Open doublejtoh opened 3 years ago
This is a bug.
OpenCV's saliency detector expects images to be typed as uint8
, but the images are float
s 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
This is a bug.
OpenCV's saliency detector expects images to be typed as
uint8
, but the images arefloat
s in the authors' implementation. So the images need to be normalized (0-255) and be changed touint8
before callingcomputeSaliency()
: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.
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:
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:
p.s. Long time no see!