def deprocess_net_image(image):
image = image.copy() # use copy don't modify destructively
image = image[::-1] # BGR to RGB
image = image.transpose(1,2,0) # CHW to HCW
image += [123,117,104] # undo mean subtraction
# clamp values in [0,255]
image[image < 0], image[image > 255] = 0 , 255
# round and cast form float32 to uint8
image = np.round(image)
image = np.require(image,dtype=np.uint8)
return image
# Load the 1000 ImageNet labels from
# ilsvrc12/synset_words.txt, and the 5 style labels from finetune_flickr_style/style_names.txt.
# Load ImageNet labels to imagenet_labels
评论列表
文章目录