Models: alexnet_v2 missing preprocessing function

Created on 19 Sep 2016  路  7Comments  路  Source: tensorflow/models

It seems that the alexnet_v2 preprocessing function is missing.
If I try to train alexnet_v2 model with

python train_image_classifier.py

I got the following error
ValueError: Preprocessing name [alexnet_v2] was not recognized

Of course on the preprocessing directory there is no alexnet_v2 key in the preprocessing_factory.py nor an alexnet_preprocessing.py file

awaiting response

Most helpful comment

@abes975 This may work for you.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import tensorflow as tf

slim = tf.contrib.slim

def preprocess_image(image, output_height, output_width, is_training=False):    
  resized_image = tf.image.resize_image_with_crop_or_pad(image, output_width, output_height)
  tf.summary.image('image', tf.expand_dims(image, 0))
  return tf.image.per_image_standardization(resized_image)

All 7 comments

Hello, @abes975 , you need to add it by yourself

@argman Well that's surely a way to do, but I thought that as alexnet is a model included in slim/nets it should be trainable using the train_image_classifier on flowers. mnist data set for example without writing any code.

@sguada could you take a look at this? Thanks.

@abes975 This may work for you.

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import tensorflow as tf

slim = tf.contrib.slim

def preprocess_image(image, output_height, output_width, is_training=False):    
  resized_image = tf.image.resize_image_with_crop_or_pad(image, output_width, output_height)
  tf.summary.image('image', tf.expand_dims(image, 0))
  return tf.image.per_image_standardization(resized_image)

Thanks @snnn! @abes975 does @snnn's solution work for you?

@yifeif thanks a lot!
Yes it perfectly answered my question!
Thanks!

@snnn @abes975 @yifeif unfortunately, training alexnet_v2 using that led to 0% accuracy. Could you have a look at #5311

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kamal4493 picture kamal4493  路  3Comments

frankkloster picture frankkloster  路  3Comments

rakashi picture rakashi  路  3Comments

XavDCtpz picture XavDCtpz  路  3Comments

sun9700 picture sun9700  路  3Comments