JustCaptain kod-buduschego
7efceb421dbc5c7b77700ed9dbec228ce6d15358
Перейти к файлу
Код
main.py
import os

from imageai.Detection import ObjectDetection


def image_detection() -> None:
    execution_path = os.getcwd()
    detector = ObjectDetection()
    detector.setModelTypeAsYOLOv3()
    detector.setModelPath(os.path.join(execution_path, "yolov3.pt"))
    detector.loadModel()
    detections = detector.detectObjectsFromImage(
        input_image=os.path.join(execution_path, "images/1.jpg"),
        output_image_path=os.path.join(execution_path, "image2new.jpg"),
        minimum_percentage_probability=30,
    )

    for eachObject in detections:
        print(eachObject)


def main() -> None:
    image_detection()


if __name__ == "__main__":
    main()