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
@@ -13,7 +13,7 @@ from models.experimental import attempt_load
|
||||
from utils.datasets import create_dataloader
|
||||
from utils.general import coco80_to_coco91_class, check_dataset, check_file, check_img_size, compute_loss, \
|
||||
non_max_suppression, scale_coords, xyxy2xywh, clip_coords, plot_images, xywh2xyxy, box_iou, output_to_target, \
|
||||
ap_per_class, set_logging, increment_dir
|
||||
ap_per_class, set_logging, increment_path
|
||||
from utils.torch_utils import select_device, time_synchronized
|
||||
|
||||
|
||||
@@ -46,10 +46,8 @@ def test(data,
|
||||
save_txt = opt.save_txt # save *.txt labels
|
||||
|
||||
# Directories
|
||||
if save_dir == Path('runs/test'): # 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
|
||||
|
||||
# Load model
|
||||
model = attempt_load(weights, map_location=device) # load FP32 model
|
||||
@@ -279,7 +277,6 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')
|
||||
parser.add_argument('--conf-thres', type=float, default=0.001, help='object confidence threshold')
|
||||
parser.add_argument('--iou-thres', type=float, default=0.65, help='IOU threshold for NMS')
|
||||
parser.add_argument('--save-json', action='store_true', help='save a cocoapi-compatible JSON results file')
|
||||
parser.add_argument('--task', default='val', help="'val', 'test', 'study'")
|
||||
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
|
||||
parser.add_argument('--single-cls', action='store_true', help='treat as single-class dataset')
|
||||
@@ -287,8 +284,10 @@ if __name__ == '__main__':
|
||||
parser.add_argument('--verbose', action='store_true', help='report mAP by class')
|
||||
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/test', 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('--save-json', action='store_true', help='save a cocoapi-compatible JSON results file')
|
||||
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')
|
||||
opt = parser.parse_args()
|
||||
opt.save_json |= opt.data.endswith('coco.yaml')
|
||||
opt.data = check_file(opt.data) # check file
|
||||
@@ -305,7 +304,6 @@ if __name__ == '__main__':
|
||||
opt.single_cls,
|
||||
opt.augment,
|
||||
opt.verbose,
|
||||
save_dir=Path(opt.save_dir),
|
||||
save_txt=opt.save_txt,
|
||||
save_conf=opt.save_conf,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user