Open arapellis-odysseas opened 3 years ago
@arapellis-odysseas The execution-flow will move to the else: print('Video has ended or failed, try a different video format!')
block only if it doesn't get any frames to process, i.e., the value of variable return_value
becomes False
. This means that the video has come to an end. But, since you are using a camera, the issue may be in the version of Python Packages you are using. To ensure that, Uncomment Step 3: Install Dependencies in the COLAB notebook shared by @theAIGuysCode and install the Python Packages written in the requirements-gpu.txt
(or requirements.txt
if you are using CPU) as below:
!pip install -r requirements-gpu.txt
.
This will install the exact versions of the Python Packages for which this code works perfectly.
Hi, I have faced this problem earlier while extracting frames from video. This happens if the frame is corrupted and hence not returned in "vid.read()".
You can use a pass statement in else to overcome this
while True:
if return_value:
return_value, frame = vid.read()
frame = cv2.cvtColor(frame, cv2.COLOR_BR2RGB)
image = Image.fromarray(frame)
else:
print("Corrupted frame")
pass
Hello, I 'm new in ml and I really feel the need to thank you for your tutorial. I tried a set up really interesting. I downloaded the Larix Broadcaster in my android phone and I set up a server to upload my video in PrimCast. (free version) . Everything set, I ran the following command python object_tracker.py --weights ./checkpoints/yolov4-tiny-416 --model yolov4 --video rtmp://162.244.80.42:1935/arapellisodisseas/livestream --tiny. After a while, the code fails according to the following image showing the terminal. It's not a real issue. Your code is perfect for me. Any insights??
Thank you.
![terminal](https://user-images.githubusercontent.com/73744541/97779518-3d6caf80-1b87-11eb-9710-094f5c5c93a5.PNG)