bilylee / SiamFC-TensorFlow

A TensorFlow implementation of the SiamFC tracker
MIT License
358 stars 112 forks source link

Change the CNN Model #24

Open ahkarami opened 6 years ago

ahkarami commented 6 years ago

Dear @bilylee, Thank you for your fantastic work. I want to change the Base CNN model of your code via another one (e.g., ResNet50). Do you have any idea that how can I do that?

bilylee commented 6 years ago

Hi,

Thanks for your interest.

You can change the base network by following these steps:

  1. create the network specification file (e.g. my_embedding.py) mimicking the format of embeddings/convolutional_alexnet.py

  2. put my_embedding.py in the embeddings/ directory

  3. replace the convolutional_alexnet in siamese_model.py and inference/inference_wrapper.py with my_embedding. (Note: More sophisticated way would be following the factory design pattern and create an embedding factory, which enables selecting the embeddings by configurations.)

ahkarami commented 6 years ago

@bilylee, Thank you very much for your complete answer. Just as another question, have you ever try other Base CNN models? (I mean that, replacing the Base CNN model with another one (e.g., ResNet50) which trained on ImageNet will increase the accuracy of the tracker?)

pmixer commented 6 years ago

@ahkarami I tried res50, it's too slow. And VOT challenge results showed that SiamFC based on resnet could improve performance. But as mentioned by @bilylee , the performance of different checkpoints varies drastically, CNN itself may not be the most important factor for building a better tracker.

ahkarami commented 6 years ago

Dear @PeterHuang2015, Thank you for your reply. Would you please release your modified tracker version (i.e., SiamFC with ResNet)? You have mentioned that: CNN itself may not be the most important factor for building a better tracker, so you mean that the motion model is more important?

pmixer commented 6 years ago

@ahkarami not sure, I am still trying to enhance the tracker, personally I suggest taking a look at these papers https://arxiv.org/abs/1802.08817 https://arxiv.org/pdf/1711.01124v4.pdf

ahkarami commented 6 years ago

@PeterHuang2015, Thank you very much for your time & response.

pmixer commented 6 years ago

@bilylee Hi bilylee, I just created a new model file in embedding folder and created a new script in experiments folder mimicking the existing files, just changed max_pooling to avg_pooling in alexnet and updated config file in experimental script in which I replaced 'convolutional_alexnet' with 'my_embedding', without modifying siamese_model.py and inference/inference_wrapper.py but it works and the validation curve and result is different from the original one.

Not sure if I was using original embedding or using the new one(with avg_pooling) as I did not obey your instructions above, could you please tell which model am I using in this way(pretty confused as I am not familiar with scared:cry:).

Regard


Checked config logs in checkpoint path, I was using original embedding file...Not sure how ex.update works. Could u please give some advice on picking up scared?(Maybe a little bit more about how you learned python and design patterns in python, really appreciate your programming skills:+1:)

bilylee commented 6 years ago

Hi,

  1. The embedding_name in the configurations currently is just a placeholder for future expansion and doesn't have any effect on the used embedding model. Therefore, you should at least modify these lines to use your custom embedding model:

https://github.com/bilylee/SiamFC-TensorFlow/blob/17f51563f081281fc7d966602d393715e7ecb469/siamese_model.py#L98

https://github.com/bilylee/SiamFC-TensorFlow/blob/17f51563f081281fc7d966602d393715e7ecb469/inference/inference_wrapper.py#L158

  1. The easiest way to learn sacred is to read the official documentation and play with it. You can get an overview of the experiments at http://sacred.readthedocs.io/en/latest/experiment.html

  2. I learn python by constantly refining my code. The first version of this project is really messy. It took me about 6 months to polish it. With the desire to improve your code, there are plenty of resources to learn python, just google it : )

pmixer commented 6 years ago

@bilylee A heart-felt big thx!:heart: