shrubb / latent-pose-reenactment

The authors' implementation of the "Neural Head Reenactment with Latent Pose Descriptors" (CVPR 2020) paper.
https://shrubb.github.io/research/latent-pose-reenactment/
Apache License 2.0
181 stars 34 forks source link

assert self.video_capture.isOpened() AssertionError in Ubuntu 20.4 #11

Closed mayanktiwariiiitdmj closed 3 years ago

mayanktiwariiiitdmj commented 3 years ago

After configuring the project as given in https://github.com/shrubb/latent-pose-reenactment/blob/master/INSTALL.md, While I am running the following command:

python utils/crop_as_in_dataset.py SOURCE="./DATASET_ROOT/videos/Jong/Jong.mp4" DESTINATION="./DATASET_ROOT/videos/Jong/outputs/"

Then I am getting the following exception:

Traceback (most recent call last):
  File "/home/admin/latent-pose-reenactment/utils/crop_as_in_dataset.py", line 663, in <module>
    image_reader = ImageReader.get_image_reader(args.source)
  File "/home/admin/latent-pose-reenactment/utils/crop_as_in_dataset.py", line 465, in get_image_reader
    return OpencvVideoCaptureReader(source)
  File "/home/admin/latent-pose-reenactment/utils/crop_as_in_dataset.py", line 534, in __init__
    assert self.video_capture.isOpened()
AssertionError

Please help me in solving this exception.

shrubb commented 3 years ago

I think it means that "./DATASET_ROOT/videos/Jong/Jong.mp4" doesn't exist. Maybe you forgot to put the dollar sign before DATASET_ROOT?

mayanktiwariiiitdmj commented 3 years ago

sir, I have checked it, the video is present in the location. I am using Ubuntu 20.4, can this be due to a different version of OS?

shrubb commented 3 years ago

No. I'm totally sure you're calling the script wrong. Check the dollar sign. Also, I don't think the SOURCE= form should work, please read python utils/crop_as_in_dataset.py --help.

mayanktiwariiiitdmj commented 3 years ago

sir, I have checked the output of the python utils/crop_as_in_dataset.py --help, I am still unable to understand how to pass the positional arguments. I request you to please provide an example of it.

shrubb commented 3 years ago

So what's the output of --help? (I'm away from a machine to test on, sorry)

mayanktiwariiiitdmj commented 3 years ago

sir, here is the output

python utils/crop_as_in_dataset.py --help
usage: crop_as_in_dataset.py [-h] [--crop-style {ffhq,latentpose}] [--image-size IMAGE_SIZE] [--save-extra-data]
                             SOURCE DESTINATION

Crop images as in training dataset

positional arguments:
  SOURCE                Where to take images from: can be
                        - path to a folder with images,
                        - path to a single image,
                        - path to a video file,
                        - 'WEBCAM_`N`', N=0,1,2... .
  DESTINATION           Where to put cropped images: can be
                        - path to a non-existent folder (will be created and filled with images),
                        - path to a maybe existing image (guessed by extension),
                        - path to a maybe existing video file (guessed by extension),
                        - 'SCREEN'.

optional arguments:
  -h, --help            show this help message and exit
  --crop-style {ffhq,latentpose}
                        Which crop style to use.
  --image-size IMAGE_SIZE
                        Size of square output images.
  --save-extra-data     If set, will save '.npy' files with keypoints alongside.
shrubb commented 3 years ago

OK, so there is the "usage:" line that tells you exactly how to run the script. Specifically, positional arguments join at the end and don't need any prefixes like "SOURCE="

mayanktiwariiiitdmj commented 3 years ago

sir, the previous error is gone by executing the command

python utils/crop_as_in_dataset.py DATASET_ROOT/videos/Jong/Jong.mp4 DATASET_ROOT/videos/Jong/outputs/

However now I am getting an exception related to libnvrtc-builtins.so.11.1. I am trying to solve it.

pfeducode commented 2 years ago

I get this problem.I think the problem is that your os environment has not encode of mp4 of ffmpeg. You need to guarantee two conditions as follows:

  1. First, installing ffmpeg on your system
  2. Second, your ffmpeg has encode of mp4

If you installed ffmpeg,but get this Problem, You can change the suffix from MP4 to avi as follows : 2022-05-16_14-33