horizon-research / edgaze

This is the official release for paper "Real-Time Gaze Tracking with Event-Driven Eye Segmentation"
GNU General Public License v3.0
43 stars 6 forks source link

the example code causes bug #8

Open Baifeng76 opened 5 months ago

Baifeng76 commented 5 months ago

Hi, there! I was running the code provided in your README about running one sequence with full-frame image with eye_net_m, but I got an error. This output is as follows:

$ python3 main.py --sequence 1 --mode org --model eye_net_m --dataset openEDS --pytorch_model_path model_weights/eye_net_m.pkl --device cpu --preview Infer openEDS/S_1 (1/151) openEDS/S_1/0.png eye segmentation baseline (400, 640) Traceback (most recent call last): File "main.py", line 253, in main() File "main.py", line 246, in main output_video_path=video_name, File "/edgaze/deepvog/inferer.py", line 148, in process Y_batch = self.model.predict(framename) File "/edgaze/edgaze/eye_segmentation.py", line 147, in predict img = skimage.color.rgb2gray(img).squeeze().astype(numpy.uint8) File "/miniconda3/envs/python/lib/python3.7/site-packages/skimage/_shared/utils.py", line 394, in fixed_func return func(*args, **kwargs) File "/miniconda3/envs/python/lib/python3.7/site-packages/skimage/color/colorconv.py", line 875, in rgb2gray rgb = _prepare_colorarray(rgb) File "/miniconda3/envs/python/lib/python3.7/site-packages/skimage/color/colorconv.py", line 140, in _prepare_colorarray raise ValueError(msg) ValueError: the input array must have size 3 along channel_axis, got (400, 640) Exception ignored in: <function VideoManager.del at 0x7f40fd0e7680> Traceback (most recent call last): File "/edgaze/deepvog/visualisation.py", line 141, in del self.vwriter.close() File "/miniconda3/envs/python/lib/python3.7/site-packages/skvideo/io/ffmpeg.py", line 430, in close if self._proc is None: # pragma: no cover AttributeError: 'FFmpegWriter' object has no attribute '_proc'

but the other example runs well. Could you please fix it?

YuFengUofR commented 4 months ago

did you change the code or input images at all? it seems like the input image dimension of function rgb2gray is incorrect

Baifeng76 commented 4 months ago

No, I didn't change the code or the input images. Now I find that predict_filtering of EyeSegmentation expands the dims of input img when the dim of it equals to 2, and seems not to use rgb2gray. But predict function doesn't do that. Maybe this caused the bug.

YuFengUofR commented 4 months ago

that might be the case, try to make data dimensions consistent.

Baifeng76 commented 4 months ago

Thanks, now the demo code runs well. I want to test the accuracy and speed of your model. Could you provide your testing code? Thanks!

Ahmet-Kaplan commented 1 week ago

Hi @Baifeng76 ,

I got same error as yours. Can you share the working code ? Thanks,

Baifeng76 commented 4 days ago

Hi @Baifeng76 ,

I got same error as yours. Can you share the working code ? Thanks,

Hi @Ahmet-Kaplan ,

I changed the line 147 of eye_segmentation.py into:

    if img.dim == 2:
        img = img.astype(numpy.unit8)
    else:
        img = skimage.color.rgb2gray(img).squeeze().astype(numpy.uint8)

and it works. Hope this can help you.

Ahmet-Kaplan commented 4 days ago

Yes, with small typo corrections, it works. if img.ndim == 2: img = img.astype (numpy.uint8) else: img = skimage.color.rgb2gray (img).squeeze ().astype (numpy.uint8)