diff --git a/demos/demo_fit_body.py b/demos/demo_fit_body.py index 8c248da..b6097e2 100644 --- a/demos/demo_fit_body.py +++ b/demos/demo_fit_body.py @@ -99,7 +99,7 @@ def main(args): visualizer.rotate_results(opdict, visdict=visdict, savepath=os.path.join(savefolder, f'{name}_vis.gif')) if args.saveObj: visualizer.save_obj(os.path.join(savefolder, name, f'{name}.obj'), opdict) - if args.saveParam: + if args.saveParam and batch['bbox'] is not None: codedict['bbox'] = batch['bbox'] util.save_pkl(os.path.join(savefolder, name, f'{name}_param.pkl'), codedict) np.savetxt(os.path.join(savefolder, name, f'{name}_bbox.txt'), batch['bbox'].squeeze()) diff --git a/pixielib/datasets/detectors.py b/pixielib/datasets/detectors.py index 7f00803..3c2a029 100644 --- a/pixielib/datasets/detectors.py +++ b/pixielib/datasets/detectors.py @@ -51,7 +51,7 @@ def run(self, input): ''' prediction = self.model(input.to(self.device))[0] inds = (prediction['labels']==1)*(prediction['scores']>0.5) - if len(inds) < 1: + if len(inds) < 1 or len(prediction['boxes'][inds]) < 1: return None else: bbox = prediction['boxes'][inds][0].cpu().numpy()