Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion python/caffe/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,14 @@ def set_mean(self, in_, mean):
if len(ms) != 3:
raise ValueError('Mean shape invalid')
if ms != self.inputs[in_][1:]:
raise ValueError('Mean shape incompatible with input shape.')
print(self.inputs[in_])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message isn't very good debugging information. A better message would explain that the sizes were incompatible and the mean shape was auto-resized for you, listing the sizes.

in_shape = self.inputs[in_][1:]
m_min, m_max = mean.min(), mean.max()
normal_mean = (mean - m_min) / (m_max - m_min)
mean = resize_image(normal_mean.transpose((1,2,0)),
in_shape[1:]).transpose((2,0,1)) * \
(m_max - m_min) + m_min
#raise ValueError('Mean shape incompatible with input shape.')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added lines 258-265 are indented by 2 spaces too many. This is a syntax error I believe.

The old code is left there commented out.

self.mean[in_] = mean

def set_input_scale(self, in_, scale):
Expand Down