-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Python wrapper: classifier.py does not initialize mean if no mean file is provided #671
Copy link
Copy link
Closed
Labels
Description
Hello,
I just tried to switch off the mean normalization like it is proposed in http://nbviewer.ipython.org/github/BVLC/caffe/blob/master/examples/imagenet_classification.ipynb . When doing so I ran into an AttributeError since when not giving a meanfile to the classifier constructor, it won't initialize self.mean which is needed in the later _Net_preprocess function in pycaffe. For now I fixed it by initializing it in the Classifier constructor.
class Classifier(caffe.Net):
"""
Classifier extends Net for image class prediction
by scaling, center cropping, or oversampling.
"""
def __init__(self, model_file, pretrained_file, image_dims=None,
gpu=False, mean_file=None, input_scale=None, channel_swap=None):I skip some stuff there.
if mean_file:
self.set_mean(self.inputs[0], mean_file)
#Chris Wendler
if mean_file == None:
self.mean = {}Correct me if I understood something wrong.
Best regards,
Chris
Reactions are currently unavailable