【发布时间】:2023-01-22 17:46:44
【问题描述】:
尝试预处理视频帧以进行异常事件检测。模型已经过训练,但我无法用以下代码找出问题。(初学者)。请帮助这位受人尊敬的开发人员。
` def Fit_Preprocessing(path: object, frames_ext: object) -> object:
if frames_ext is None:
raise TypeError(
'Invalid Value for argument `frames_ext`, it cannot be None. Give proper extensions of the frames e.g: `.tif` or `.png` etc!')
print('\n\nProcessing Images in this Dataset Path: {0}\n'.format(path))
file_names: List[Union[str, List[str]]]
onlyfiles, file_names, dirs = ReadFileNames(path, frames_ext)
img_list = [1, 2, 3, 4]
for img in tqdm(range(len(onlyfiles))):
images = onlyfiles[img]
count = 0
for images in onlyfiles[img]:
img.split('/')
img_name = dirs[i] + '_' + file_names[i][count]
write_path = 'ProcessedImages/' + path.split('/')[1]
gray = ProcessImg(img_name, read_path=img, write=True,
write_path=write_path, res_shape=(227, 227))
img_list.append(gray)
count += 1
return img_list
` 收到此错误:
在此数据集中处理图像路径:C:/Users/Public/Downloads/Surveillance with deep learning/Datasets/UCSD_Anomaly_Dataset.v1p2/UCSDped1/Test
0%| | 0/47 [00:00<?, ?it/s] 回溯(最后一次通话): 文件“C:/Users/Public/Downloads/Surveillance-with-deep-learning/preprocessing.py”,第 171 行,位于 img_list: object = Fit_Preprocessing(路径, frames_ext='.Fit') 文件“C:/Users/Public/Downloads/Surveillance-with-deep-learning/preprocessing.py”,第 154 行,在 Fit_Preprocessing 中 对于 onlyfiles[img] 中的图像: TypeError: 'int' 对象不可迭代
进程结束,退出代码为 1
1 尝试使用 images = img_list 来修复循环但它不起作用(初学者)
【问题讨论】:
标签: python-3.7