blitzkrieg0000 commited on
Commit
c1fd56b
1 Parent(s): 1563971

Update Lib/BirdNestDetection.py

Browse files
Files changed (1) hide show
  1. Lib/BirdNestDetection.py +11 -1
Lib/BirdNestDetection.py CHANGED
@@ -9,6 +9,8 @@
9
  """
10
  import os
11
  import sys
 
 
12
  sys.path.append(os.getcwd())
13
 
14
  import random
@@ -18,9 +20,17 @@ import torchvision
18
  import onnxruntime as ort
19
  import cv2
20
  import numpy as np
 
 
21
  from Lib.Const import LABELS, COLOR_MAP, COLOR_MAP_RGB
22
 
23
 
 
 
 
 
 
 
24
  def scale_coords(img1_shape, coords, img0_shape, ratio_pad=None):
25
  # Rescale coords (xyxy) from img1_shape to img0_shape
26
  if ratio_pad is None: # calculate from img0_shape
@@ -223,7 +233,7 @@ def plot_one_box(x, img, color=None, label=None, line_thickness=3):
223
 
224
 
225
  print(ort.get_available_providers())
226
- session = ort.InferenceSession("Weight/yolov7_kus.onnx", providers=ort.get_available_providers())
227
 
228
  input_name = session.get_inputs()[0].name
229
  print("input name", input_name)
 
9
  """
10
  import os
11
  import sys
12
+
13
+
14
  sys.path.append(os.getcwd())
15
 
16
  import random
 
20
  import onnxruntime as ort
21
  import cv2
22
  import numpy as np
23
+
24
+ from Tool.Core import DownloadHFModel
25
  from Lib.Const import LABELS, COLOR_MAP, COLOR_MAP_RGB
26
 
27
 
28
+ # Download Model
29
+ REPO_ID = "blitzkrieg0000/yolov7_bird-nest-detection"
30
+ MODEL_FILE = "yolov7_kus.onnx"
31
+ DownloadHFModel(REPO_ID, MODEL_FILE)
32
+
33
+
34
  def scale_coords(img1_shape, coords, img0_shape, ratio_pad=None):
35
  # Rescale coords (xyxy) from img1_shape to img0_shape
36
  if ratio_pad is None: # calculate from img0_shape
 
233
 
234
 
235
  print(ort.get_available_providers())
236
+ session = ort.InferenceSession(os.path.join("./Weight", MODEL_FILE), providers=ort.get_available_providers())
237
 
238
  input_name = session.get_inputs()[0].name
239
  print("input name", input_name)