aiknowyou-nic commited on
Commit
574d3c5
·
1 Parent(s): 2bc6100

fix rgb to bgr

Browse files
Files changed (3) hide show
  1. app.py +6 -2
  2. poetry.lock +0 -0
  3. pyproject.toml +19 -0
app.py CHANGED
@@ -14,7 +14,8 @@ with open("classes.names", 'r') as f:
14
 
15
 
16
  def predict(inp):
17
- img = cv2.resize(inp, (700, 700))
 
18
  height, width, channels = img.shape
19
 
20
  # Convert image into blob and load it on model
@@ -65,7 +66,10 @@ def predict(inp):
65
  cv2.putText(img, label + " " + conf_value, (x, y-10),
66
  cv2.FONT_HERSHEY_COMPLEX, 1, (0, 255, 0), 2)
67
  # return the images
68
- return img
 
 
 
69
 
70
 
71
  gr.Interface(
 
14
 
15
 
16
  def predict(inp):
17
+ img_bgr = inp.astype('uint8')[...,::-1]
18
+ img = cv2.resize(img_bgr, (700, 700))
19
  height, width, channels = img.shape
20
 
21
  # Convert image into blob and load it on model
 
66
  cv2.putText(img, label + " " + conf_value, (x, y-10),
67
  cv2.FONT_HERSHEY_COMPLEX, 1, (0, 255, 0), 2)
68
  # return the images
69
+ cv2.imwrite("out.jpg", img)
70
+
71
+ img_rgb = img[...,::-1]
72
+ return img_rgb
73
 
74
 
75
  gr.Interface(
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "yolo-volley-detection"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["nicola.landro <[email protected]>"]
6
+ readme = "README.md"
7
+ packages = [{include = "yolo_volley_detection"}]
8
+
9
+ [tool.poetry.dependencies]
10
+ python = "^3.10"
11
+ matplotlib = "^3.6.2"
12
+ gradio = "^3.9.1"
13
+ opencv-python = "^4.6.0.66"
14
+ numpy = "^1.23.4"
15
+
16
+
17
+ [build-system]
18
+ requires = ["poetry-core"]
19
+ build-backend = "poetry.core.masonry.api"