I want to use the yolov5 model in django, but I got trouble.
What I want to make is if user upload an image to django server, object detection made by with the yolov5 model, and then the result displayed on the web. The process itself is simple. But I am not sure how to attach yolov5 api and django.
As those of you who have used yolo know, yolo basically runs apis based on commands.
!python train.py --img 512 --batch 16 --epochs 100 --data ~~ # for training
!python detect.py --weights'/content/yolov5/runs/~~ # for detection
Is there any way to run this in a Django view?
I tried python functions such as execfile() and os.system() that execute commands in an interpreter way within Python script, but it didn't work properly. (I think the paths between Django and Yolo were twisted.)
In fact, if possible, it is best to load yolo api as a module like Keras and run it like a function, rather than the command method. But I can't find a way to use yolov5 like a module or something like that.
How can I solve this problem? Please give me some advice.

