jazzsaxmafia / Weakly_detector

Tensorflow implementation of "Learning Deep Features for Discriminative Localization"
361 stars 87 forks source link

All-in-one Jupyter notebook for Caltech dataset #9

Open MasoodK opened 7 years ago

MasoodK commented 7 years ago

A Jupyter notebook including the main files needed to train the VGG model on Caltech256 dataset. Notebook includes code updates (TF v1.2) and documentation, among others.

taylorty commented 6 years ago

Hi, First thank you so much for creating this. It was really helpful. I tried to run the last part of the code on my customized dataset where it should generate the CAM images. But it seems to run forever to generate the images. Do you have any idea about why it occurs? Thank you.

MasoodK commented 6 years ago

@taylorty , glad you found the notebook useful. Not sure, however, I understand what your specific issue is. You will need to reproduce the whole A-Z of the process/cells in your environment. If that checks out, then you can proceed to adapt the model to your own dataset. By adapting, I mean doing at least some training before going to prediction, so that the model is correctly tuned to the number of labels, etc., in your set. To help you debug along the way, you can use simple Print statements to check things, or move to Python or TensorFlow debug tools if needed. Hope this helps :)

taylorty commented 6 years ago

@MasoodK I just figured out what was the problem. Adding %matplotlib inline before plotting makes everything work as expected.

Rahul-Venugopal commented 5 years ago

Hi , Thanks for your effort and the notebook was really helpful . May I Know whether a trained model is available which I can use to test on caltech256 dataset ?

Rahul-Venugopal commented 5 years ago

@MasoodK @jazzsaxmafia I am running the jupyter notebook code and when I run the cell for training I get the following error :

TypeError Traceback (most recent call last)

in 15 labels_tf = tf.placeholder( tf.int64, [None], name='labels') 16 ---> 17 detector = Detector(weight_path, n_labels) 18 19 p1,p2,p3,p4,conv5, conv6, gap, output = detector.inference(images_tf) in __init__(self, weight_file_path, n_labels) 5 6 with open(weight_file_path) as f: ----> 7 self.pretrained_weights = cPickle.load(f) 8 9 def get_weight( self, layer_name): TypeError: a bytes-like object is required, not 'str'

Can anyone help me to understand the mistake I am making ?

MasoodK commented 5 years ago

Hi , Thanks for your effort and the notebook was really helpful . May I Know whether a trained model is available which I can use to test on caltech256 dataset ?

@Rahul-Venugopal The link to the Caffe model is already provided by the repo owner; you'd download that file. The code/notebook loads that up and starts the fine-tuning.

Regarding your 2nd comment: you gotta have basic Python debugging skills to have a crack at this. Not sure what your issue is; looks like you've indicated a wrong path to the model file or sth similar.