Skip to content

Commit 2db6ec0

Browse files
committedAug 8, 2021
YOLO Custom Pred
1 parent 005a2f3 commit 2db6ec0

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,4 @@ cfg/
151151
coco.names
152152
*.h5
153153
*.mlmodel
154+
backup/

‎quickai/yolo/chart.png

64.1 KB
Loading

‎quickai/yolo/chart_yolov4-obj.png

64.1 KB
Loading

‎quickai/yolo/detect_custom.py

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import os
2+
3+
4+
class YOLOV4_Custom:
5+
def __init__(
6+
self,
7+
data_file="data/obj.data",
8+
cfg_file="cfg/yolov4-obj.cfg",
9+
media_type="image",
10+
video=None,
11+
image=None,
12+
weights="./yolov4.weights"):
13+
14+
self.train_data_path = train_data_path
15+
self.test_data_path = test_data_path
16+
self.data_file = data_file
17+
self.cfg_file = cfg_file
18+
self.weights = weights
19+
self.image = image
20+
self.video = video
21+
22+
if media_type == "image":
23+
self.predict_image()
24+
else:
25+
self.predict_video()
26+
27+
def darknet(self, term):
28+
"""[a function to invoke the darknet command]
29+
30+
Args:
31+
term ([string]): [the command that needs to be executed after the darknet invocation]
32+
"""
33+
command = f"darknet {term}"
34+
35+
os.system(command)
36+
37+
def predict_image(self):
38+
self.darknet(
39+
f"detector test {self.data_file} {self.cfg_file} {self.weights} {self.image}")
40+
41+
def predict_video(self):
42+
self.darknet(
43+
f"detector demo {self.data_file} {self.cfg_file} {self.weights} {self.video}")

‎setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"License :: OSI Approved :: MIT License",
2222
"Operating System :: OS Independent",
2323
],
24-
packages=["quickai/"],
24+
packages=["quickai/", "quickai/yolo/"],
2525
python_requires=">=3.6",
2626
install_requires=[
2727
'scikit-learn',

0 commit comments

Comments
 (0)
Please sign in to comment.