diff --git a/scripts/evaluate_svhn_tinierssd.sh b/scripts/evaluate_svhn_tinierssd.sh new file mode 100755 index 000000000..878da7549 --- /dev/null +++ b/scripts/evaluate_svhn_tinierssd.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python train.py --deterministic --print-freq 200 --model ai85tinierssd --use-bias --dataset SVHN_74 --device MAX78000 --obj-detection --obj-detection-params parameters/obj_detection_params_svhn.yaml --qat-policy policies/qat_policy_svhn.yaml --evaluate -8 --exp-load-weights-from ../ai8x-synthesis/trained/ai85-svhn-tinierssd-qat8-q.pth.tar "$@" diff --git a/train.py b/train.py old mode 100755 new mode 100644 index 6b95ba795..9e59eea29 --- a/train.py +++ b/train.py @@ -194,6 +194,10 @@ def main(): print('WARNING: Initial learning rate (--lr) not set, selecting 0.1.') args.lr = 0.1 + if args.generate_sample is not None and not args.act_mode_8bit: + print('WARNING: Cannot save sample in training mode, ignoring --save-sample option. ' + 'Use with --evaluate instead.') + msglogger = apputils.config_pylogger(os.path.join(script_dir, 'logging.conf'), args.name, args.output_dir) @@ -1020,6 +1024,7 @@ def save_tensor(t, f, regression=True): end = time.time() class_probs = [] class_preds = [] + sample_saved = False # Track if --save-sample has been done for this validation step # Get object detection params obj_detection_params = parse_obj_detection_yaml.parse(args.obj_detection_params) \ @@ -1091,9 +1096,9 @@ def save_tensor(t, f, regression=True): and model.__dict__['_modules'][key].wide): output /= 256. - if args.generate_sample is not None: + if args.generate_sample is not None and args.act_mode_8bit and not sample_saved: sample.generate(args.generate_sample, inputs, target, output, args.dataset, False) - return .0, .0, .0, .0 + sample_saved = True if args.csv_prefix is not None: save_tensor(inputs, f_x)