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

Predict video on local #243

Merged
merged 12 commits into from Jun 22, 2023
Merged

Conversation

jihyeonyi
Copy link
Contributor

Add feature of video reconstruction with overlaid predictions on a local machine.

2. change predict_video to use ffmpeg instead of moviepy. (moviepy produces 1 extra frame to original video)
3. add unit test code and data for predict_video.py
4. change function name of predict_video to `predict_video_on_local` for clarification
2. add license info regarding ffmpeg-python
@jihyeonyi
Copy link
Contributor Author

I have some concerns.

  1. FFmpeg is need to preserve sound of the video. But it needs to be installed by user. I documented this information to exampels/README.md, but where is the best place to put this information?
  2. How to add ffmpeg to test environment?
  3. I added test data to tests/data/dice. Is it a correct way ?

@jihyeonyi jihyeonyi marked this pull request as ready for review June 15, 2023 07:08
Copy link
Contributor

@samet-akcay samet-akcay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jihyeonyi for the effort! I've now gone through the first round of my review.

requirements/requirements.txt Outdated Show resolved Hide resolved
tests/data/dice/deployment/Detection task/README.md Outdated Show resolved Hide resolved
geti_sdk/demos/predict_video.py Outdated Show resolved Hide resolved
geti_sdk/demos/predict_video.py Outdated Show resolved Hide resolved
geti_sdk/demos/predict_video.py Show resolved Hide resolved
geti_sdk/demos/predict_video.py Outdated Show resolved Hide resolved
@ljcornel
Copy link
Collaborator

ljcornel commented Jun 19, 2023

Many thanks for the PR @jihyeonyi. In general it looks good but I'm worried about the installation hassle that the use of ffmpeg introduces. I'm wondering, would it be possible to switch to a library like imageio-ffmpeg (https://github.com/imageio/imageio-ffmpeg) instead? From my understanding it should take care of ffmpeg installation automatically and should also be able to handle audio. Could you have a look at that?

I will do a full review of the PR today or tomorrow at the latest, I've been way too busy so apologies for the delay

@jihyeonyi
Copy link
Contributor Author

@ljcornel, I'll take a look at imageio-ffmpeg. At first glance, it seems difficult to change the package easily. But I'll try and let you know.

geti_sdk/demos/predict_video.py Outdated Show resolved Hide resolved
geti_sdk/demos/predict_video.py Show resolved Hide resolved
geti_sdk/demos/predict_video.py Outdated Show resolved Hide resolved
geti_sdk/demos/predict_video.py Outdated Show resolved Hide resolved
geti_sdk/demos/predict_video.py Outdated Show resolved Hide resolved
examples/predict_video_on_local.py Outdated Show resolved Hide resolved
examples/predict_video_on_local.py Outdated Show resolved Hide resolved
logging.basicConfig(level=log_level)

# --------------------------------------------------
# Configuration section
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really in line with the configuration in the other examples. Currently, there is no configuration that the user has to do, because it's all specified in the command line args.

I suggest to make it so that it is possible to run the script against a live Geti instance as well, for which configuration (hostname, credentials, project name) would be required.

From my perspective, there are two use cases for the script:

  1. The user passes a deployment path, and predictions are generated from there (no server configuration needed)
  2. The user passes a Geti host, credentials, and a project name. A Deployment is created for the target project on the fly

The 2nd option requires additional configuration. Please have a look at the other examples to check how it's handled there, it's fine if users have to make minor edits in the scripts. All examples were set up like this.

tests/pre-merge/unit/demos/test_predict_video.py Outdated Show resolved Hide resolved
@jihyeonyi
Copy link
Contributor Author

I replaced ffmpeg-python with imageio-ffmpeg. I modified the code to call ffmpeg directly using subprocess.run(), because we don't need frame-by-frame operations which imageio-ffmpeg provides.

@jihyeonyi
Copy link
Contributor Author

@ljcornel I'm waiting for your review. Please have a look.

Copy link
Collaborator

@ljcornel ljcornel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was waiting for you to address my comment #243 (comment) regarding the two use cases for the script. I saw now that you added some instructions to the readme for obtaining the project deployment, that's fine with me. Thank you

@ljcornel ljcornel merged commit 50cd8eb into openvinotoolkit:main Jun 22, 2023
3 checks passed
@jihyeonyi jihyeonyi deleted the predict_video branch July 14, 2023 08:10
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

Successfully merging this pull request may close these issues.

None yet

3 participants