Unified '/project/name' results saving (#1377)
* Project/name update * Update ci-testing.yml * address project with path separator failure mode * Project/name update * address project with path separator failure mode * Update ci-testing.yml * detect.py default --name bug fix * missing rstrip PR * train/exp0 to train/exp
This commit is contained in:
1 parent
04081f8102
commit
c4addd7761
7 files changed
+71
-78
No files matched your search
@@ -10,21 +10,18 @@ from numpy import random
|
||||
from models.experimental import attempt_load
|
||||
from utils.datasets import LoadStreams, LoadImages
|
||||
from utils.general import check_img_size, non_max_suppression, apply_classifier, scale_coords, xyxy2xywh, \
|
||||
plot_one_box, strip_optimizer, set_logging, increment_dir
|
||||
plot_one_box, strip_optimizer, set_logging, increment_path
|
||||
from utils.torch_utils import select_device, load_classifier, time_synchronized
|
||||
|
||||
|
||||
def detect(save_img=False):
|
||||
save_dir, source, weights, view_img, save_txt, imgsz = \
|
||||
Path(opt.save_dir), opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size
|
||||
source, weights, view_img, save_txt, imgsz = opt.source, opt.weights, opt.view_img, opt.save_txt, opt.img_size
|
||||
webcam = source.isnumeric() or source.endswith('.txt') or \
|
||||
source.lower().startswith(('rtsp://', 'rtmp://', 'http://'))
|
||||
|
||||
# Directories
|
||||
if save_dir == Path('runs/detect'): # if default
|
||||
save_dir.mkdir(parents=True, exist_ok=True) # make base
|
||||
save_dir = Path(increment_dir(save_dir / 'exp', opt.name)) # increment run
|
||||
(save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make new dir
|
||||
save_dir = Path(increment_path(Path(opt.project) / opt.name, exist_ok=opt.exist_ok)) # increment run
|
||||
(save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make dir
|
||||
|
||||
# Initialize
|
||||
set_logging()
|
||||
@@ -156,12 +153,13 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--view-img', action='store_true', help='display results')
|
||||
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
|
||||
parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels')
|
||||
parser.add_argument('--save-dir', type=str, default='runs/detect', help='directory to save results')
|
||||
parser.add_argument('--name', default='', help='name to append to --save-dir: i.e. runs/{N} -> runs/{N}_{name}')
|
||||
parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --class 0, or --class 0 2 3')
|
||||
parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
|
||||
parser.add_argument('--augment', action='store_true', help='augmented inference')
|
||||
parser.add_argument('--update', action='store_true', help='update all models')
|
||||
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')
|
||||
opt = parser.parse_args()
|
||||
print(opt)
|
||||
|
||||
|
||||
Reference in new issue
Block a user