我正在尝试运行微表达式识别代码,这是链接:https://github.com/bogireddytejareddy/micro-expression-recognition
我遇到一个特定的错误,这是引发错误的代码:
directorylisting = os.listdir(negativepath)
for video in directorylisting:
videopath = negativepath + video
frames = []
framelisting = os.listdir(videopath)
framerange = [x for x in frames if x != 0]
for frame in framerange:
imagepath = videopath + "/" + framelisting[frame]
image = cv2.imread(imagepath)
imageresize = cv2.resize(image, (image_rows, image_columns), interpolation = cv2.INTER_AREA)
grayimage = cv2.cvtColor(imageresize, cv2.COLOR_BGR2GRAY)
frames.append(grayimage)
frames = numpy.asarray(frames)
videoarray = numpy.rollaxis(numpy.rollaxis(frames, 2, 0), 2, 0)
training_list.append(videoarray)
enter code here
directorylisting = os.listdir(negativepath)
该错误与numpy.rollaxis函数有关。现在这是该错误的说明:
/usr/local/Cellar/python/3.7.5/bin/python3.7 /Users/Rajat_Sharma/PycharmProjects/untitled1/micro-expression-recognition-master/SMIC/MicroExpSTCNN.py
Using TensorFlow backend.
Traceback (most recent call last):
File "/Users/Rajat_Sharma/PycharmProjects/untitled1/micro-expression-recognition-master/SMIC/MicroExpSTCNN.py", line 39, in <module>
videoarray = numpy.rollaxis(numpy.rollaxis(frames, 2, 0), 2, 0)
File "<__array_function__ internals>", line 6, in rollaxis
File "/usr/local/lib/python3.7/site-packages/numpy/core/numeric.py", line 1256, in rollaxis
axis = normalize_axis_index(axis, n)
numpy.AxisError: axis 2 is out of bounds for array of dimension 1
P.S:原谅我犯了明显的错误,我只是一个初学者:)