Skip to content

Commit

Permalink
update README.md for demo.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangGongjie committed Apr 19, 2022
1 parent a74b093 commit e6666f6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,15 @@ python -m torch.distributed.launch \
```


### Visualize Detection Results
We perform `demo.py`, which is a minimal implementation that allows users to visualize model's detection predictions. It performs detection on images inside the `./images` folder, and stores detection results visualizations on that folder. Taking <b>SAM-DETR-R50 w/ SMCA (50 epochs)</b> for example, simply run:
```shell
python demo.py \ # do NOT use distributed mode
--batch_size 1 \
--smca \
--epochs 50 \ # you need to set this correct. See models/fast_detr.py L50-79 for details.
--resume <path/to/checkpoint.pth> # trained model weights
```



Expand Down
3 changes: 2 additions & 1 deletion demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_args_parser():
parser.add_argument('--lr_backbone', default=1e-5, type=float)
parser.add_argument('--lr_linear_proj_names', default=[], type=str, nargs='+')
parser.add_argument('--lr_linear_proj_mult', default=0.1, type=float)
parser.add_argument('--batch_size', default=2, type=int)
parser.add_argument('--batch_size', default=1, type=int)
parser.add_argument('--weight_decay', default=1e-4, type=float)
parser.add_argument('--epochs', default=50, type=int)
parser.add_argument('--lr_drop', default=40, type=int)
Expand Down Expand Up @@ -99,6 +99,7 @@ def get_args_parser():


def main(args):

utils.init_distributed_mode(args)

if args.frozen_weights is not None:
Expand Down
Binary file modified images/det_res_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/det_res_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e6666f6

Please sign in to comment.