infocusp / tf_cnnvis

CNN visualization tool in TensorFlow
MIT License
781 stars 209 forks source link

How to generate single class based feature #88

Open robonetphy opened 3 years ago

robonetphy commented 3 years ago

I have similar network and I want to generate single class based feature as shown in readme.md
But in document using deepdream you are only visualizing layer not one class? So how we extract one class based feature?

So please guide us for our research ....🙏

BhagyeshVikani commented 3 years ago

Hello @robonetphy

You can specify layer and the class index for which you want to generate deepdream visualization.

is_success = deepdream_visualization(sess_graph_path = tf.get_default_graph(), value_feed_dict = {t_input : im}, layer=layer, classes = [1, 2, 3, 4, 5], path_logdir=os.path.join("Log","Inception5"), path_outdir=os.path.join("Output","Inception5"))

Above example will generate 5 deepdream visualizations each for different classes(1, 2, 3, 4, 5). And 'layer' should be name of the last layer/last operation.

Example Notebook: tf_cnnvis_Example3

robonetphy commented 3 years ago

Thank you very much.this will help a lot to achieve our goal.