簡體   English   中英

運行預訓練 ImageAI 模型的問題

[英]Problem with running a pre-trained ImageAI model

我正在運行代碼以學習如何從這篇文章中教授 AI/ML 進行對象檢測: https : //medium.com/deepquestai/train-object-detection-ai-with-6-lines-of-code-6d087063f6ff (非常好的一個順便說一句;-)

我下載了預訓練模型並在 Google Colab 上運行

似乎我得到了一個錯誤:''' --> 761 image_frame = image.copy() 762 image_frame2 = image.copy() 763 height, width, channels = image.shape

'AttributeError: 'NoneType' object has no attribute 'copy' 
on line 8: ----> 8 detections = 
detector.detectObjectsFromImage(input_image="holo3.jpg", 
output_image_path="holo3-detected.jpg")'

有什么可以幫助這里的,因為它應該是一個預先訓練、測試過的代碼?

我已經通過 Stackoverflow 進行了搜索,但沒有找到答案。

from imageai.Detection.Custom import CustomObjectDetection

detector = CustomObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath("hololens-ex-60--loss-2.76.h5") 
detector.setJsonPath("detection_config.json")
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image="holo3.jpg", 
output_image_path="holo3-detected.jpg")
for detection in detections:
print(detection["name"], " : ", detection["percentage_probability"], " : ", detection["box_points"])

AttributeError                            Traceback (most recent call last)

<ipython-input-6-31fc5f7df048> in <module>()
  6 detector.setJsonPath("detection_config.json")
  7 detector.loadModel()
----> 8 detections = 
detector.detectObjectsFromImage(input_image="holo3.jpg", 
output_image_path="holo3-detected.jpg")
  9 for detection in detections:
 10     print(detection["name"], " : ", 
detection["percentage_probability"], " : ", detection["box_points"])

/usr/local/lib/python3.6/dist-packages/imageai/Detection/Custom/__init__.py in detectObjectsFromImage(self, input_image, output_image_path, input_type, output_type, extract_detected_objects, minimum_percentage_probability, nms_treshold, display_percentage_probability, display_object_name)
759 
760 
--> 761             image_frame = image.copy()
762             image_frame2 = image.copy()
763             height, width, channels = image.shape

AttributeError: 'NoneType' object has no attribute 'copy'

由於圖像文件夾中不存在訓練和驗證文件夾注釋 XML 圖像路徑,我發現了類似的錯誤。 檢查圖像名稱是否與您的注釋 XML 文件路徑相同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM