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
RuntimeWarning: invalid value encountered in divide
gaze = (((gaze-gaze.min())/(gaze.max()-gaze.min())) * 255).astype(np.uint8)
RuntimeWarning: invalid value encountered in cast
gaze = (((gaze-gaze.min())/(gaze.max()-gaze.min())) * 255).astype(np.uint8)
can we update code with this ?
def getPatchGaze(self, gaze: NDArray[Any]) -> NDArray[Any]:
g = np.zeros((56,56), dtype=np.float32)
for i in range(56):
for j in range(56):
x1 = 4*i-7
x2 = 4*i+7
y1 = 4*j-7
y2 = 4*j+7
if x1 < 0:
x1 = 0
if y1 < 0:
y1 = 0
if x2 > 223:
x2 = 223
if y2 > 223:
y2 = 223
g[i,j] = gaze[x1:x2, y1:y2].sum()
# Check if the range of g is suitable for normalization
if g.max() - g.min()!= 0:
g = (g - g.min()) / (g.max() - g.min())
else:
# Handle the case where all values are the same
g = np.full_like(g, 127.5) # Set to middle value of uint8 range
# Cast to uint8, handling NaN values by setting them to 0
g = np.nan_to_num(g).astype(np.uint8)
return g
The text was updated successfully, but these errors were encountered:
Debugging
can we update code with this ?
The text was updated successfully, but these errors were encountered: