我尝试运行这段代码(我的程序的一小部分)我修复并添加了空格,现在我得到了新的错误,也许这个数组不适合字符串?
arrayOfPhotos = ["1.jpg", "2.jpg", "3.jpg", "4.jpg"]
for name in arrayOfPhotos:
detections = detector.detectObjectsFromImage(input_image=arrayOfPhotos[name], output_image_path="holo3-detected.jpg")
for detection in detections:
print(arrayOfPhotos[name], " : ", detection["percentage_probability"])
我得到错误:
Traceback (most recent call last):
File "dTEST.py", line 13, in <module>
detections = detector.detectObjectsFromImage(input_image=arrayOfPhotos[name], output_image_path="holo3-detected.jpg")
TypeError: list indices must be integers or slices, not str
你能帮助我吗?