Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to put the pre-training model in the right place? #5

Open
xiaopingzeng opened this issue Nov 29, 2018 · 7 comments
Open

How to put the pre-training model in the right place? #5

xiaopingzeng opened this issue Nov 29, 2018 · 7 comments

Comments

@xiaopingzeng
Copy link

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?

@Rahul-Venugopal
Copy link

Hi @xiaopingzeng ,

Did you figure this out ?

@xiaomengyc
Copy link
Owner

You have two choices

  1. mkdir -p snapshots/inception_imagenet_full_spg
    cp ***.pth.zip snapshots/inception_imagenet_full_spg/
    The script of utils/Restore.py will 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.

  2. add the variable restore_from to your testing script. The value of this variable should be the path of your saved trained model.

@Rahul-Venugopal
Copy link

Rahul-Venugopal commented Dec 6, 2018

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 ?

@xiaomengyc
Copy link
Owner

xiaomengyc commented Dec 6, 2018

@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.

@Rahul-Venugopal
Copy link

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

@Rahul-Venugopal
Copy link

Hi @xiaomengyc ,

Is there any update on demo script on testing as you mentioned before ?

@xiaomengyc
Copy link
Owner

Hi @Rahul-Venugopal ,

Sorry for the late reply.
The demo scripts have been uploaded. Please refer to the setup_demo.txt for more guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants