Hi all,
I am conducting my processing and I am getting an unusual error that I am not sure how to interpret.
Can someone help me understand this error, please?
I have my code located in the datastore and what is funny is that the same code is running efficiently sometimes on the same data and then suddenly I am presented with this error.
MY CODE:***************************************
import numpy as np
import cv2
class Videoto3D:
def __init__(self, width, height, depth):
self.width = width
self.height = height
self.depth = depth
def video3d(self, filename, color=False, skip=True):
cap = cv2.VideoCapture(filename)
nframe = cap.get(cv2.CAP_PROP_FRAME_COUNT)
if skip:
frames = [x * nframe / self.depth for x in range(self.depth)]
else:
frames = [x for x in range(self.depth)]
framearray = []
for i in range(self.depth):
cap.set(cv2.CAP_PROP_POS_FRAMES, frames[i])
ret, frame = cap.read()
frame = cv2.resize(frame, (self.height, self.width))
if color:
framearray.append(frame)
else:
framearray.append(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY))
cap.release()
return np.array(framearray)
def get_UCF_classname(self, filename):
return filename# Controls the length of the class Name
#ORIGINAL CODE
# def get_UCF_classname(self, filename):
# return filename[filename.find('_') + 1:filename.find('_', 20)]# Controls the length of the class Name
My Errors****************************
Generating/Join Class Labels For Video Dataset For Input Completed
100%|█████████████████████████████████████████████| 5/5 [00:21<00:00, 5.49s/it]OpenCV: Couldn't read video stream from file "./dataset/Fighting/.DS_Store"
[ERROR:0@25.086] global /Users/runner/work/opencv-python/opencv-python/opencv/modules/videoio/src/cap.cpp (166) open VIDEOIO(CV_IMAGES): raised OpenCV exception:
OpenCV(4.5.5) /Users/runner/work/opencv-python/opencv-python/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): ./dataset/Fighting/.DS_Store in function 'icvExtractPattern'
Traceback (most recent call last):
File "3dcnn9.py", line 1053, in <module>
main()
File "3dcnn9.py", line 318, in main
x, y = loaddata(args.videos, vid3d, args.nclass,
File "3dcnn9.py", line 205, in loaddata
X.append(vid3d.video3d(name, color=color, skip=skip))
File "/Users/mmgp0hotmail.com/opt/3DCNN/3DCNNtesting/videoto3d.py", line 25, in video3d
frame = cv2.resize(frame, (self.height, self.width))
cv2.error: OpenCV(4.5.5) /Users/runner/work/opencv-python/opencv-python/opencv/modules/imgproc/src/resize.cpp:4052: error: (-215:Assertion failed) !ssize.empty() in function 'resize'