为什么在imageAI中出现TypeError?

时间:2019-11-13 11:56:25

标签: python imageai

使用let url = URL(string: "https://www.example.com/font.ttf")! let task = URLSession.shared.downloadTask(with: url) { localURL, urlResponse, error in if let localURL = localURL { do { let documentsURL = try FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) let savedURL = documentsURL.appendingPathComponent("font.ttf") try FileManager.default.moveItem(at: localURL, to: savedURL) } catch { print ("file error: \(error)") } } } task.resume() 时出现错误。
我已尝试对imageAI进行故障排除,并且确定它是正确的,我出了什么问题?

我的操作系统Ubuntu 18+和运行Python 2+。 我的代码如下:

python

file path
  

我得到的错误:

import os
from imageai.Detection import ObjectDetection

execution_path = os.getcwd()

custom_path = "/home/tcslab/Desktop/project-test/"

detector = ObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath( os.path.join(execution_path , "yolo.h5"))
detector.loadModel()

# if os.path.isfile(os.path.join(custom_path, "image.jpg")):
#     print(1)

detections = \
    detector.detectObjectsFromImage(extract_detected_objects = True,
                                    input_image=os.path.join(custom_path, "image.jpg"), 
                                    input_type="file", 
                                    output_type="file", 
                                    output_image_path=os.path.join(custom_path, "image.jpg"), 
                                    minimum_percentage_probability=30
                                    )

for eachObject in detections:
    print(eachObject["name"] , " : ", eachObject["percentage_probability"], " : ", eachObject["box_points"] )
    print("--------------------------------")

0 个答案:

没有答案