title: How to use yolov5 model in django
body: <p>I want to use the yolov5 model in django, but I got trouble.</p>
  <p>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.
  <strong>But I am not sure how to attach yolov5 api and django.</strong></p>
  <p>As those of you who have used yolo know, yolo basically runs apis based on commands.</p>
  <pre><code>!python train.py --img 512 --batch 16 --epochs 100 --data ~~   # for training
  !python detect.py --weights'/content/yolov5/runs/~~            # for detection
  </code></pre>
  <p><strong>Is there any way to run this in a Django view?</strong></p>
  <p>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.)</p>
  <p><strong>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.</strong></p>
  <p>How can I solve this problem?
  Please give me some advice.</p>