ikhlestov / vision_networks

Repo about neural networks for images handling
MIT License
264 stars 122 forks source link

Is there some way to get the softmax (probability values) from the saved models using the repos code. #29

Closed saksham-s closed 6 years ago

saksham-s commented 6 years ago

Hi, is there some way to get the softmax probability values from the saved models instead of the final class predictions.

ikhlestov commented 6 years ago

Yes, of course. You just need to modify code a little bit and fetch required values under the session scope. For example if you want to fetch logits you need: modify those lines - https://github.com/ikhlestov/vision_networks/blob/master/models/dense_net.py#L343-L344 with code like: self.logits = logits and later on provide some additional method:

def fetch_logits(self, inputs):
    feed_dict = {self.images: inputs}
    logits_res = self.sess.run([self.logits], feed_dict=feed_dict)
    return logits_res

With such approach actually you can get values for any tensor, from saved or newly initialized model