cia-labs / vision-tech

Feral's vision tech part of the pilot program for ISM
0 stars 2 forks source link

Package YoloV5 as a service.(API) #17

Closed Tejas-ChandraShekarRaju closed 1 week ago

Tejas-ChandraShekarRaju commented 7 months ago

A POC is done via YOLOv5 model which detects an elephant in the picture. Currently Works well for detecting elephants but there are false positives that has to be dealt with. In order to create a testing pipeline we will go ahead and package this as a service.

  1. Create a FAST API App and Integrate the Yolo POC within the model. (https://github.com/Tejas-ChandraShekarRaju/VisionX/blob/9-yolov5-poc/yoloelephantpoc.ipynb)
  2. Create an API to call this service from Which-images.
noobed-max commented 6 months ago

Created an a FastAPI server to which images can be uploaded and the respective result can be obtained

https://github.com/noobed-max/YoloV5-FastAPI-server

noobed-max commented 6 months ago

hey so here is another thing

turns out the run function in detect.py doesnt have any return value and all the return is handled by another function inside util.general.py by using LOGGER funtion which communicates with the function print_args to generate the required text to print in terminal

so far in the detect.py the only thing that we can handle is the image output ig which is image 1/1 /home/deadsec/projects/yolo_yolo/yolov5/temp_storage/image_1.jpg: 448x640 (no detections), 91.4msSpeed: 0.6ms pre-process, 91.4ms inference, 0.2ms NMS per image at shape (1, 3, 640, 640)Results saved to \x1b[1mruns/detect/exp2\x1b[0m'

and the following for elephant detectin

'image 1/1 /home/deadsec/projects/yolo_yolo/yolov5/temp_storage/image_2.jpg: 448x640 1 Elephant, 59.8msSpeed: 0.4ms pre-process, 59.8ms inference, 0.7ms NMS per image at shape (1, 3, 640, 640)Results saved to \x1b[1mruns/detect/exp3\x1b[0m'

as u can see 1 Elephant is for pic with elephant in it and no detection if there is none

further the output which is handled by general.py over terminal is printing of model parameters like

main: weights=['/home/deadsec/projects/yolo_yolo/runs/train/exp/weights/best.pt'], source=/home/deadsec/projects/yolo_yolo/2.jpg, data=/home/deadsec/projects/yolo_yolo/runs/train/exp/hyp.yaml, imgsz=[640, 640], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_csv=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1 YOLOv5 🚀 v7.0-284-g95ebf68f Python-3.10.12 torch-2.2.0+cu121 CPU

Fusing layers... YOLOv5s summary: 157 layers, 7012822 parameters, 0 gradients, 15.8 GFLOPs