Open sendjasni opened 3 years ago
Did you execute it following the jupyter tutorial?
I am currently not getting this error. Could you check what is the gaze_positions.shape at that point? (It should be an N-by-3 array)
Hi,
The gaze_positions.shape
gave (125, 3)
and its return the same error.
I changed one line in the code as it returns an error (AttributeError: module 'time' has no attribute 'clock'):
self.real_time_last_saccade = time.clock()
changed to self.real_time_last_saccade = time.process_time()
Which python version are you currently using?
Python 3.8.5
The python version should be fine.
My guess is that for some reason the fixation detector is returning an empty array. Could you check it out?
To do so, please modify get_fixations() to:
def get_fixations(eye_positions):
x = fixation_detection(eye_positions[:, 1], eye_positions[:, 0], eye_positions[:, 2] * 1000.)[1]
print("Fixation detector output shape:", x.shape)
return np.array(x)[:, (3, 4, 0, 1)]
This is what I got :
Fixation detector output shape: (0,)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-6-9f266b28fe4d> in <module>
----> 1 list_of_fixations = eymol.get_fixations(gaze_positions)
~/Worspace/G-Eymol/eymol.py in get_fixations(eye_positions)
682 print("Fixation detector output shape:", np.array(x).shape)
683
--> 684 return np.array(x)[:, (3, 4, 0, 1)]
IndexError: too many indices for array
I have changed the image and it's working, I used another one and it did not. Do you know why ? Here is the output for the one it worked:
img.shape : (2688, 5376, 3)
gaze_positions.shape : (125, 3)
Fixation detector output shape : (1, 5)
List of fixation points ([pixel row, pixel column, intial time, final time]): [[2928. 1584. 120. 280.]]
In such a case everything is "working"... but there are some numerical problems. From your working image, you actually get a single fixation from a 5 seconds simulation, which is not good (and this can be due to ill-gradient scaling).
You should get something like this instead (where every blue point is a fixation):
Next check I suggest you is to verify if you fed an image properly (this may very with different codec). Please verify that your pixel range between 0 and 255. Normalize them otherwise.
The reason is the following. This model work using image gradient as an actractive force that guide the attention mechanism. If you rescale the image gradient, you need to search to new hyperparameter because default would not work.
Thank you, @dariozanca I'm actually trying to use your model on panoramic images, which are high resolution images. The image attributes are :
img = cv2.imread('010.png')
img.shape
print('Data range : ', np.amin(img), np.amax(img))
This gives :
(2048, 4096, 3)
Data range : [0, 255]
Calling
get_fexations()
gives an error :list_of_fixations = eymol.get_fixations(gaze_positions)