Why are the "activations" and "predict" functions giving such different responses for my trained CNN?
2 views (last 30 days)
Show older comments
Over the past few months, I have been training CNNs to recognize two object categories (really, a binary "A or not A" measure) in imagery. All of my previous efforts have been in one-band images. Upon training completion, I have been using the activations and predict functions to test new imagery. All of my training chips are 128x128x1 inputs. To find the objects in larger images, I use activations:
featureMap = activations(trainednet,testimage,'softmax','OutputAs','channels')
whereas, to test single 128x128x1 chips, I use _predict:
predict(trainednet,testimagechip)
I believe that the results of these two functions have always been equivalent. That is, if the local activations result for a given testimage location for categories 1 and 2 were p and 1-p, respectively, the predict function for a 128x128x1 chip of testimage taken from that location was also p and 1-p.
Recently, I have moved on to using 3-band test imagery (actually, a pseudocolor product in which bands 1 and 2 are identical while 3 is different). My training curves look very similar to the 1-band case, and I am reaching 98+% training accuracy as before. However, the outputs of activations and predict no longer match up. If I apply activations to a 3-band test image and look at the probabilities for my two categories, they are totally different than the predict output for a chip at that same location.
I have no idea why this is occurring. Should these two functions give equivalent results? Was it a fluke in the past that these two functions gave the same result? The predict result is giving me what I expect from the network, while the activations is not. However, I need to use the activations function, as it is the only efficient way I have to search larger images (a sliding application on the predict function is way slow). My end goal is to train the network to recognize the feature and identify that feature in larger images, not to feed it individual chips.
Thank you.
0 Comments
Answers (0)
See Also
Categories
Find more on Deep Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!