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

fix(back-end): video processing failing when no face #141

Merged
merged 4 commits into from
Nov 21, 2023

Conversation

MyStackOverflows
Copy link
Contributor

Welcome to PrivacyPal! 👋

Fixes: #45

Description of the change:

Implement logic to handle sections of video where a face is not present, minor cleanup/refactoring, and extended tests for the new logic.

Motivation for the change:

Prior to this patch, videos with even half a second of no face would crash the video processor and the progress on the video would be lost.

@MyStackOverflows MyStackOverflows added fix Fixes for something broken area/back-end Back-end work labels Nov 20, 2023
@MyStackOverflows MyStackOverflows self-assigned this Nov 20, 2023
@tthvo tthvo changed the title bugfix(back-end): fix video processing failing when no face fix(back-end): fix video processing failing when no face Nov 20, 2023
@MyStackOverflows MyStackOverflows changed the title fix(back-end): fix video processing failing when no face fix(back-end): video processing failing when no face Nov 21, 2023
@tthvo
Copy link
Contributor

tthvo commented Nov 21, 2023

Rebase pls :))

Copy link
Contributor

@tthvo tthvo left a comment

Choose a reason for hiding this comment

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

Code makes sense! Tho, I am running some issues while manual testing:

  1. Using the videos in app/video-processing/resources/test.mp4.
Process Process-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/app/video_processor.py", line 129, in process
    box = self.get_face(frames[i])
IndexError: list index out of range
  1. Using a random video, for example as below, I see no output videos even though
INFO:     10.0.2.100:51108 - "POST /process_video HTTP/1.1" 200 OK
Done processing /opt/privacypal/input-videos/test1.mp4.
test1.mp4

@MyStackOverflows
Copy link
Contributor Author

weird. when I was testing, I used make oci-build and then make run in app/video-processing and everything worked as expected (I wasn't using the smoketest). Now when trying to use smoketest I'm realizing it doesn't create the input-videos or output-videos folders that map to the volume, did something change with that?

@MyStackOverflows
Copy link
Contributor Author

as for the index out of range, that's really bizarre. never got it on any videos before but you're right, with the resources/test.mp4 video it comes up. after looking into it it looks like it was a perfect storm of the frame gap (12) and the exact number of frames the video had (132) causing a mis-written loop (the n + 1 is a logical error, I thought range() included both start and stop points but it's inclusive start exclusive stop) to error out trying to get index 132 of a list only having indexes 0-131

@tthvo
Copy link
Contributor

tthvo commented Nov 21, 2023

weird. when I was testing, I used make oci-build and then make run in app/video-processing and everything worked as expected (I wasn't using the smoketest). Now when trying to use smoketest I'm realizing it doesn't create the input-videos or output-videos folders that map to the volume, did something change with that?

Sounds right. As for compose, smoketests are using named volume so no directory mounts are used.

@MyStackOverflows
Copy link
Contributor Author

Sounds right. As for compose, smoketests are using named volume so no directory mounts are used.

ahh okay makes sense, I was looking at the yaml for smoketest but I don't fully understand everything in it. anything else I should look into/change?

@tthvo
Copy link
Contributor

tthvo commented Nov 21, 2023

  1. Using a random video, for example as below, I see no output videos even though
INFO:     10.0.2.100:51108 - "POST /process_video HTTP/1.1" 200 OK
Done processing /opt/privacypal/input-videos/test1.mp4.
test1.mp4

Yeh for this one, I noticed that the output file was generated and written to fs. But then, about 2-3s later, it is deleted. Do you have any other videos that have no face at all for the entire video for testing? Perhaps try that too?

@MyStackOverflows
Copy link
Contributor Author

Yeh for this one, I noticed that the output file was generated and written to fs. But then, about 2-3s later, it is deleted. Do you have any other videos that have no face at all for the entire video for testing? Perhaps try that too?

hmm I can't reproduce the file being deleted issue. the temp video with no audio is deleted at the end of process(), but the final video with blurred video and src audio should stick around. I have tested with videos with no face -> face, face -> no face, no face -> face -> no face, and no face for the whole video

@tthvo tthvo merged commit 17edeca into develop Nov 21, 2023
7 checks passed
@tthvo tthvo deleted the gh-45-vidproc-no-face-error branch November 30, 2023 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/back-end Back-end work fix Fixes for something broken
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants