Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the example code causes bug #8

Open
Baifeng76 opened this issue Apr 1, 2024 · 7 comments
Open

the example code causes bug #8

Baifeng76 opened this issue Apr 1, 2024 · 7 comments

Comments

@Baifeng76
Copy link

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
Copy link
Collaborator

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

@Baifeng76
Copy link
Author

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
Copy link
Collaborator

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

@Baifeng76
Copy link
Author

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
Copy link

Hi @Baifeng76 ,

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

@Baifeng76
Copy link
Author

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
Copy link

Ahmet-Kaplan commented Aug 25, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants