Closed sunnycia closed 7 years ago
@CLT29
I have also encountered this problem, so how to solve this problem? @CLT29
Problem solved.
from Salicon import Salicon
import cv2
import numpy as np
sal = Salicon()
pred = sal.compute_saliency("face.jpg")
map = pred / np.max(pred) * 255
cv2.imwrite("output.jpg", map.astype(int))
The float numbers between [0,1] are image intensity values. You will need to scale those to your desired range (e.g. 255) before using. Glad you figured it out.
Hey chris , I tried to use these code to get a saliency map of face.jpg
from Salicon import Salicon
from PIL import Image
import numpy as np
sal = Salicon()
map = sal.compute_saliency("face.jpg")
img = Image.fromarray(map, mode="L")
img.save("face_saliency.jpg")
Then I got a picture of chaos. I checked out the content of the ndarray
print map
I found that the items in this ndarray are not integers between 1 and 255. What are those float numbers stand for? What should I do with these number in order to get a correct saliency map? Gracias ;)