Skip to content

Commit acb2c69

Browse files
authored
Merge pull request #492 from shreyas-bk/master
use latest saved weights in tutorial
2 parents a2aa13e + c55c198 commit acb2c69

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tutorial/train_shape.ipynb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,15 @@
463463
"outputId": "f38ef0e7-bf30-428a-cf93-43e43a60fdae"
464464
},
465465
"source": [
466-
"! python coco_eval.py -c 0 -p shape -w logs/shape/efficientdet-d0_49_1400.pth"
466+
"#get latest weight file\n",
467+
"%cd logs/shape\n",
468+
"weight_file = !ls -Art | grep efficientdet\n",
469+
"%cd ../..\n",
470+
"\n",
471+
"#uncomment the next line to specify a weight file\n",
472+
"#weight_file[-1] = 'efficientdet-d0_49_1400.pth'\n",
473+
"\n",
474+
"! python coco_eval.py -c 0 -p shape -w \"logs/shape/{weight_file[-1]}\""
467475
],
468476
"execution_count": 4,
469477
"outputs": [
@@ -575,7 +583,7 @@
575583
" ratios=[(1.0, 1.0), (1.4, 0.7), (0.7, 1.4)],\n",
576584
" scales=[2 ** 0, 2 ** (1.0 / 3.0), 2 ** (2.0 / 3.0)])\n",
577585
"\n",
578-
"model.load_state_dict(torch.load('logs/shape/efficientdet-d0_49_1400.pth'))\n",
586+
"model.load_state_dict(torch.load('logs/shape/'+weight_file[-1]))\n",
579587
"model.requires_grad_(False)\n",
580588
"model.eval()\n",
581589
"\n",

0 commit comments

Comments
 (0)