Untitled

 avatar
unknown
python
5 months ago
919 B
2
Indexable
from anomalib import TaskType
from anomalib.deploy import OpenVINOInferencer
from loguru import logger
import os

def inference():
    inferencer = OpenVINOInferencer(
        path='/media/ishmeet/Data/Work/Freelancing/SolarPanelDefectIdentification/ModelExport/weights/openvino/model.bin',  # Path to the OpenVINO IR model.
        metadata='/media/ishmeet/Data/Work/Freelancing/SolarPanelDefectIdentification/ModelExport/weights/openvino/metadata.json',  # Path to the metadata file.
        device="CPU",
        task=TaskType.CLASSIFICATION
    )
    logger.info('Load model successfully')
    folder_path = "/home/ishmeet/Desktop/Good_Images/05.09.2024/"
    for file_name in os.listdir(folder_path):
        predictions = inferencer.predict(folder_path + file_name)
        logger.info('{}: {}, {:.4f}'.format(file_name, predictions.pred_label, predictions.pred_score))

if __name__ == "__main__":
    inference()
Editor is loading...
Leave a Comment