def normalize(img): img = tf.cast(img,tf.float32)/255.0 return img def one_hot_label(labels,num_classes): label = tf.one_hot(labels,depth=num_classes) return label def reshape_img(img,shape,channels): img = tf.expand_dims(img,axis=-1) img = tf.image.resize(img,(shape,shape)) return img def img_normalize_one_hot(img,label,config): img = reshape_img(img,config["image_size"],config["image_channels"]) img = normalize(img) label = one_hot_label(label,config["num_classes"]) return img,label __ __