diff --git a/README.md b/README.md index f742653c2f11..bd98c491e3d2 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,10 @@ Download MS COCO dataset images ([train](http://images.cocodataset.org/zips/trai The re-parameterization code and instruction will release soon. +## Inference + +`python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source inference/images/horses.jpg` + ## Citation ``` diff --git a/detect.py b/detect.py index 607386a244a9..53b63ebfb16f 100644 --- a/detect.py +++ b/detect.py @@ -16,7 +16,7 @@ def detect(save_img=False): - source, weights, view_img, save_txt, imgsz, trace = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size, opt.trace + 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 save_img = not opt.nosave and not source.endswith('.txt') # save inference images webcam = source.isnumeric() or source.endswith('.txt') or source.lower().startswith( ('rtsp://', 'rtmp://', 'http://', 'https://')) @@ -128,6 +128,7 @@ def detect(save_img=False): if save_img: if dataset.mode == 'image': cv2.imwrite(save_path, im0) + print(f" The image with the result is saved in: {save_path}") else: # 'video' or 'stream' if vid_path != save_path: # new video vid_path = save_path @@ -169,7 +170,7 @@ def detect(save_img=False): parser.add_argument('--project', default='runs/detect', help='save results to project/name') parser.add_argument('--name', default='exp', help='save results to project/name') parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment') - parser.add_argument('--trace', action='store_true', help='trace model') + parser.add_argument('--no-trace', action='store_true', help='don`t trace model') opt = parser.parse_args() print(opt) #check_requirements(exclude=('pycocotools', 'thop')) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000000..6b71f216897c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,39 @@ +# Usage: pip install -r requirements.txt + +# Base ---------------------------------------- +matplotlib>=3.2.2 +numpy>=1.18.5 +opencv-python>=4.1.1 +Pillow>=7.1.2 +PyYAML>=5.3.1 +requests>=2.23.0 +scipy>=1.4.1 +torch>=1.7.0,!=1.12.0 +torchvision>=0.8.1,!=0.13.0 +tqdm>=4.41.0 +protobuf<4.21.3 + +# Logging ------------------------------------- +tensorboard>=2.4.1 +# wandb + +# Plotting ------------------------------------ +pandas>=1.1.4 +seaborn>=0.11.0 + +# Export -------------------------------------- +# coremltools>=4.1 # CoreML export +# onnx>=1.9.0 # ONNX export +# onnx-simplifier>=0.3.6 # ONNX simplifier +# scikit-learn==0.19.2 # CoreML quantization +# tensorflow>=2.4.1 # TFLite export +# tensorflowjs>=3.9.0 # TF.js export +# openvino-dev # OpenVINO export + +# Extras -------------------------------------- +ipython # interactive notebook +psutil # system utilization +thop # FLOPs computation +# albumentations>=1.0.3 +# pycocotools>=2.0 # COCO mAP +# roboflow diff --git a/test.py b/test.py index 8478f5ef35be..569a5d1d82f6 100644 --- a/test.py +++ b/test.py @@ -303,7 +303,7 @@ def test(data, parser.add_argument('--project', default='runs/test', help='save to project/name') parser.add_argument('--name', default='exp', help='save to project/name') parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment') - parser.add_argument('--trace', action='store_true', help='trace model') + parser.add_argument('--no-trace', action='store_true', help='don`t trace model') opt = parser.parse_args() opt.save_json |= opt.data.endswith('coco.yaml') opt.data = check_file(opt.data) # check file @@ -324,7 +324,7 @@ def test(data, save_txt=opt.save_txt | opt.save_hybrid, save_hybrid=opt.save_hybrid, save_conf=opt.save_conf, - trace=opt.trace, + trace=not opt.no_trace, ) elif opt.task == 'speed': # speed benchmarks