How to put the pre-training model in the right place?
Which folder should I put the pre-training model “cub_epoch_100_glo_step_20200.pth.zip” and “imagenet_epoch_2_glo_step_128118.pth.zip” in?
Hi @xiaopingzeng ,
Did you figure this out ?
You have two choices
-
mkdir -p snapshots/inception_imagenet_full_spgcp ***.pth.zip snapshots/inception_imagenet_full_spg/The script ofutils/Restore.pywill automatically load the least saved model according to the save date. You can also read through this script to make some modifications for your convinience. -
add the variable
restore_fromto your testing script. The value of this variable should be the path of your saved trained model.
Thanks @xiaomengyc
...I have done that and now the pretrained model "cub_epoch_100_glo_step_20200.pth.zip" is loaded . As mentioned in your page , I am using
sh val_cub_full.sh to generate attention maps . Is there any test script which I have to use for generating heatmap on a new image ? or can I use val_cub_full.sh for the same purpose ?
I have edited val_cub_full.sh as following
#!/bin/sh
cd ../exper/
#v5_v3
ROOT_DIR=/home/rr/Desktop/The/Reference/WSOL/ACoL/SPG
CUDA_VISIBLE_DEVICES=0 python val_frame.py --arch=inception3_spg
--batch_size=1
--img_dir=${ROOT_DIR}/test_images/
--train_list=${ROOT_DIR}/datalist/CUB/train_list.txt
--test_list=${ROOT_DIR}/datalist/CUB/test_list.txt
--num_gpu=1
--dataset=cub
--num_classes=200
--snapshot_dir=../snapshots/inception_imagenet_full_spg/ --onehot=False
I am trying to use model trained on CUB . If I want to generate attention map on a new image , where should I put the image and what modifications should I make on the script ?
@Rahul-Venugopal
If you want to test on a new dataset without largely changing this code, a feasible solution I suggest is to generate a testing list file like datalist/test_list.txt.
But no worries! I am preparing a demo script for testing arbitrary single image. Hope I can finish this in a few days.
By the way, if you'd like testing a random image, it would be better to use the model trained on ImageNet, because the CUB dataset only contains many kinds of birds.
Hi , Thanks for replying. And I hope a demo script will be very helpful and thanks for your effort.
By the way , I have already tried creating a testing file like datalist/test_list.txt .
When i run sh val_cub_full.sh , a masked image as similair to the output of proposed network is created under ../save_bins .
Is it possible to create attention map as shown in figure or my be bounding boxes ?
When i check ../util/save_attn.py , some portions to generate heatmaps are commented out. Do I have to modify anything there to generate attention maps ?
Thanks Rahul
Hi @xiaomengyc ,
Is there any update on demo script on testing as you mentioned before ?
Hi @Rahul-Venugopal ,
Sorry for the late reply. The demo scripts have been uploaded. Please refer to the setup_demo.txt for more guidance.