def image_preprocessing(image_buffer, bbox, train, thread_id=0):
 if (bbox is None):
  raise ValueError('Please supply a bounding box.')
 image = decode_jpeg(image_buffer)
 height = FLAGS.image_size
 width = FLAGS.image_size
 if train:
  image = distort_image(image, height, width, bbox, thread_id)
 else:
  image = eval_image(image, height, width)
 image = tf.sub(image, 0.5)
 image = tf.mul(image, 2.0)
 return image

def image_preprocessing ( image_buffer , bbox , train , thread_id = 0 ) : if ( bbox is None ) : raise ValueError ( 'Please supply a bounding box.' ) image = decode_jpeg ( image_buffer ) height = FLAGS . image_size width = FLAGS . image_size if train : image = distort_image ( image , height , width , bbox , thread_id ) else : image = eval_image ( image , height , width ) image = tf . sub ( image , 0.5 ) image = tf . mul ( image , 2.0 ) return image
decode and preprocess one image for evaluation or training .