Skip to content

Commit dfc6817

Browse files
committed
Added requirements.txt
1 parent 9cd3774 commit dfc6817

File tree

4 files changed

+48
-4
lines changed

4 files changed

+48
-4
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ Download MS COCO dataset images ([train](http://images.cocodataset.org/zips/trai
9090

9191
The re-parameterization code and instruction will release soon.
9292

93+
## Inference
94+
95+
`python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source inference/images/horses.jpg`
96+
9397
## Citation
9498

9599
```

detect.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
def detect(save_img=False):
19-
source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace
19+
source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, not opt.no_trace
2020
save_img = not opt.nosave and not source.endswith('.txt') # save inference images
2121
webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith(
2222
('rtsp://', 'rtmp://', 'http://', 'https://'))
@@ -128,6 +128,7 @@ def detect(save_img=False):
128128
if save_img:
129129
if dataset.mode == 'image':
130130
cv2.imwrite(save_path, im0)
131+
print(f" The image with the result is saved in: {save_path}")
131132
else: # 'video' or 'stream'
132133
if vid_path != save_path: # new video
133134
vid_path = save_path
@@ -169,7 +170,7 @@ def detect(save_img=False):
169170
parser.add_argument('--project', default='runs/detect', help='save results to project/name')
170171
parser.add_argument('--name', default='exp', help='save results to project/name')
171172
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
172-
parser.add_argument('--trace', action='store_true', help='trace model')
173+
parser.add_argument('--no-trace', action='store_true', help='don`t trace model')
173174
opt = parser.parse_args()
174175
print(opt)
175176
#check_requirements(exclude=('pycocotools', 'thop'))

requirements.txt

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Usage: pip install -r requirements.txt
2+
3+
# Base ----------------------------------------
4+
matplotlib>=3.2.2
5+
numpy>=1.18.5
6+
opencv-python>=4.1.1
7+
Pillow>=7.1.2
8+
PyYAML>=5.3.1
9+
requests>=2.23.0
10+
scipy>=1.4.1
11+
torch>=1.7.0,!=1.12.0
12+
torchvision>=0.8.1,!=0.13.0
13+
tqdm>=4.41.0
14+
protobuf<4.21.3
15+
16+
# Logging -------------------------------------
17+
tensorboard>=2.4.1
18+
# wandb
19+
20+
# Plotting ------------------------------------
21+
pandas>=1.1.4
22+
seaborn>=0.11.0
23+
24+
# Export --------------------------------------
25+
# coremltools>=4.1 # CoreML export
26+
# onnx>=1.9.0 # ONNX export
27+
# onnx-simplifier>=0.3.6 # ONNX simplifier
28+
# scikit-learn==0.19.2 # CoreML quantization
29+
# tensorflow>=2.4.1 # TFLite export
30+
# tensorflowjs>=3.9.0 # TF.js export
31+
# openvino-dev # OpenVINO export
32+
33+
# Extras --------------------------------------
34+
ipython # interactive notebook
35+
psutil # system utilization
36+
thop # FLOPs computation
37+
# albumentations>=1.0.3
38+
# pycocotools>=2.0 # COCO mAP
39+
# roboflow

test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def test(data,
303303
parser.add_argument('--project', default='runs/test', help='save to project/name')
304304
parser.add_argument('--name', default='exp', help='save to project/name')
305305
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
306-
parser.add_argument('--trace', action='store_true', help='trace model')
306+
parser.add_argument('--no-trace', action='store_true', help='don`t trace model')
307307
opt = parser.parse_args()
308308
opt.save_json |= opt.data.endswith('coco.yaml')
309309
opt.data = check_file(opt.data) # check file
@@ -324,7 +324,7 @@ def test(data,
324324
save_txt=opt.save_txt | opt.save_hybrid,
325325
save_hybrid=opt.save_hybrid,
326326
save_conf=opt.save_conf,
327-
trace=opt.trace,
327+
trace=not opt.no_trace,
328328
)
329329

330330
elif opt.task == 'speed': # speed benchmarks

0 commit comments

Comments
 (0)