icatcherplus / icatcher_plus

iCatcher+: Robust and automated annotation of infant gaze from videos collected in laboratory, field, and online studies
GNU General Public License v3.0
18 stars 19 forks source link

iCatcher Speeding Up Output Videos #60

Closed nereeth closed 1 year ago

nereeth commented 1 year ago

For some of the videos that I run through iCatcher, iCatcher automatically speeds up the output videos by a significant amount (ex. I input a video that is 2 minutes long, iCatcher returns a video that is 200 miliseconds long). Clipping videos to make them shorter solves the problem for some, but not all videos. Not sure what is causing this problem or if there is a setting I can change to prevent it.

Using:

iCatcher version 0.1.1
Python version 3.10.09
Windows operating system

edit: it also fails to produce output videos for the others--instead, it returns the following errors/warnings:

OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12 and format 'mp4 / MP4 (MPEG-4 Part 14)' OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'

edit2: do you know if there is a way to uninstall iCatcher+ and just go back to regular iCatcher?

nereeth commented 1 year ago

The command lines that I have been using to make output videos are:

icatcher C:\Users\nereeth\Documents\icatcher_input --output_video_path C:\Users\nereeth\Documents\icatcher_output --output_annotation C:\Users\nereeth\Documents\icatcher_annotations

yoterel commented 1 year ago

Hi, Thanks for providing all the information. Firstly, I think you would benefit from checking out https://icatcherplus.github.io/ for an explanation of relevant flags to use.

In your particular case, It looks like you are using the CPU for annotation, which means you need to customize the running of iCatcher to suit your needs (track B in the website).

There are two problems you have stated which I will address separately:

1) Videos are not processed at all (the second problem)

This in my opinion is just a misunderstanding of what is going on: the new iCatcher default models are quite beefy, and so processing is much slower on CPU. You can always fallback to the faster models by doing the following:

icatcher C:\Users\nereeth\Documents\icatcher_input --output_video_path C:\Users\nereeth\Documents\icatcher_output --output_annotation C:\Users\nereeth\Documents\icatcher_annotations --model icatcher+_lookit.pth --fd_model opencv_dnn

I added two flags which force icatcher+ to use the faster models, that were used in the original paper, but are less accurate than the new models.

I will also add, that if you still want to use the new models (more accurate) and not use a GPU, you might want to turn on the verbosity (--verbosity debug) to see outputs from icatcher and what is it doing at any given moment.

Can you verify this works for you?

2) output videos are sped up (the first problem)

I used the video you sent me to try reproducing this error, but I have not been able to get a sped up video using the exact version of icatcher, operating system, and python you are using. This makes me suspicious of the ffmpeg version you are using, so can you try to please run ffmpeg in your command line (when the environment is activated, if you are using one) and send the output? also can you please provide the output you get when running conda env list

I will add here that we used ffmpeg version 4.3.1, so if you got any version that is equal or above that it should be fine.

Finally,

do you know if there is a way to uninstall iCatcher+ and just go back to regular iCatcher?

You mean going back to an older version of iCatcher+ right?

If you want to downgrade (highly not recommend) you can do pip uninstall icatcher

and then

pip install icatcher==0.0.10

if you wanted version 0.0.10 The reason this isn't recommended is because we fixed some bugs from previous versions, and in any case you can always fallback to the original models as stated above (problem 1)

nereeth commented 1 year ago

Hi Yotam,

This was very helpful, thank you! The code you provided fixed both problems, so now my videos are all being processed and the right length.

My ffmpeg is the wrong version (4.2.2), so I will also fix that later today.

Thank you so much!