classification_models_3D icon indicating copy to clipboard operation
classification_models_3D copied to clipboard

How to make sure preprocess function is doing what it's supposed to?

Open mazatov opened this issue 3 years ago • 3 comments

For example, I'm trying out resnet152 and the preprocess_function doesn't seem to do anything. Just giving back the same output.

ResNet18, preprocess_input = Classifiers.get('resnet18')
preprocess_input(np.array([[1000,1],[-2,5]]))
Out[27]: 
array([[1000,    1],
       [  -2,    5]])

mazatov avatar Dec 08 '21 15:12 mazatov

As I remember these models were trained without any preprocessing.

Thier first layer is BatchNorm:

    # resnet bottom
    x = layers.BatchNormalization(name='bn_data', **no_scale_bn_params)(img_input)

ZFTurbo avatar Dec 08 '21 15:12 ZFTurbo

Interesting. I was just basing it on this line: ResNet18, preprocess_input = Classifiers.get('resnet18')

mazatov avatar Dec 08 '21 15:12 mazatov

Yes. You do it right. preprocess_input for these models returns input as is.

ZFTurbo avatar Dec 08 '21 16:12 ZFTurbo