Попытка реплицировать этот репозиторий: https://github.com/sujiongming/UCF-101_video_classification. Я получаю следующую ошибку при запуске файла CNN_train_UCF101.py.
Traceback (most recent call last):
File "CNN_train_UCF101.py", line 18, in <module>
data = DataSet()
File "D:\Clones\UCF-101_video_classification-master\UCFdata.py", line 32, in __init__
self.classes = self.get_classes()
File "D:\Clones\UCF-101_video_classification-master\UCFdata.py", line 64, in get_classes
if item[1] not in classes:
IndexError: list index out of range
часть кода, на которую ссылаются, выглядит следующим образом:
def get_data():
"""Load our data from file."""
with open('./data/data_file.csv', 'r') as fin:
reader = csv.reader(fin)
data = list(reader)
def clean_data(self):
"""Limit samples to greater than the sequence length and fewer
than N frames. Also limit it to classes we want to use."""
data_clean = []
for item in self.data:
if int(item[3]) >= self.seq_length and int(item[3]) <= self.max_frames \
and item[1] in self.classes:
data_clean.append(item)
return data_clean
def get_classes(self):
"""Extract the classes from our data. If we want to limit them,
only return the classes we need."""
classes = []
for item in self.data:
if item[1] not in classes:
classes.append(item[1])
# Sort them.
classes = sorted(classes)
# Return.
if self.class_limit is not None:
return classes[:self.class_limit]
else:
return classes
Я обновил вопрос, чтобы прояснить data
. Когда я делаю print (self.data)
, я получаю что-то вроде этого: ['train', 'UnevenBars', 'v_UnevenBars_g22_c04', '126'], []
для каждого изображения в наборе данных.
Может кто-нибудь показать мне, что я делаю неправильно. Заранее спасибо.
Window 10
Python 3.7.6