Comments (7)
I have the same error:
cv2.error("OpenCV(3.4.4) C:\\projects\\opencv-python\\opencv\\modules\\imgproc\\src\\color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'\n")
from video2tfrecord.
The program crashes even after installing the exact opencv version specified in the requirements.txt file (opencv-python==3.4.0.12),
the error code however, changed to:
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cv::cvtColor, file C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp, line 11079
from video2tfrecord.
@ferreirafabio Have you any idea how to resolve this error or any other way for the conversion?
from video2tfrecord.
I went ahead and debugged the code, here are my conclusions:
video2tfrecord.py:291
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
No check is being done on whether the frame is None.
This is causing the original crash
video2tfrecord.py:294
stop, cap, steps, prev_frame_none, frames_counter = repeat_image_retrieval( cap, file_path, take_all_frames, steps, frame, prev_frame_none, frames_counter)
This was probably written for older opencv signature, the new one require the video as a parameter, (and henceforth returns tuple of size 6 and not 5)
No break check or frames_counter increase at
video2tfrecord.py: 301
Causing an infinite loop...
video2tfrecord.py: 294
Using the frame_counter name as unpack variable is overriding the internal counter and again causing an infinite loop...
video2tfrecord.py: 294
Using the cap name as unpack variable and overriding the original cap.
If the cap is being set to None the program again crashes at
video2tfrecord.py: 338
This may be a bug, and maybe not. Im not sure what is the appropriate behavior but in
video2tfrecord.py: 301
It seems video[frames_counter, :, :, :].fill(0)
would be more logical than to erase the whole video.
@fascinet I have pushed this changes into a fork: https://github.com/danielbraun89/video2tfrecord
for a quick fix you can just use your own pip installed version and copy the content of https://github.com/danielbraun89/video2tfrecord/blob/master/video2tfrecord.py
into the video2tfrecord.py file that is being used in your installed package.
also I have tested it in the latest opencv, I recommend running a
pip install opencv-python -U
and disregard the requirements.txt opencv version until the official fix will arrive
from video2tfrecord.
Thank you for your reply. It worked very well BTW Great Observation.
from video2tfrecord.
Thank you for these findings and for reporting them. Would you be interested in creating a pull request such that all users would benefit from your bugfixes? I unfortunately don't have time to incorporate these in the next weeks/months. I also don't have time to check whether these reported findings are actually bugs
from video2tfrecord.
Thank you all for your support. The suggestion have now been merged into the master.
from video2tfrecord.
Related Issues (11)
- Need to specify frames per video HOT 1
- How about including the audio information and then write to the same tfRecords? HOT 5
- Add an option to convert and save grey scale videos. HOT 3
- AssertionError: something went wrong during video to numpy conversion HOT 2
- Unknown command line flag 'f' HOT 5
- Too much storage required HOT 2
- Problem in numpy HOT 5
- High memory use HOT 2
- new problem HOT 1
- assertion error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from video2tfrecord.