Learn practical skills, build real-world projects, and advance your career
import os
import cv2
import numpy as np
import scipy.io as sio
import tensorflow as tf
CROP_SIZE = [473, 473]
IMG_MEAN = np.array((103.939, 116.779, 123.68), dtype=np.float32)
def load_img(img_path):
    if not os.path.isfile(img_path):
        print('Not found file: {0}'.format(img_path))
        exit(0)

    filename = img_path.split('/')[-1]
    ext = filename.split('.')[-1]

    if ext.lower() == 'png':
        return tf.image.decode_png(tf.io.read_file(img_path), channels=3)
    elif ext.lower() == 'jpg':
        return tf.image.decode_jpeg(tf.io.read_file(img_path), channels=3)
    else:
        print('cannot process {0} file.'.format(filename))
        exit(0)
!wget https://upload.wikimedia.org/wikipedia/commons/thumb/2/23/Wilsons_Promontory_National_Park_%28AU%29%2C_Big_Drift_--_2019_--_1683.jpg/800px-Wilsons_Promontory_National_Park_%28AU%29%2C_Big_Drift_--_2019_--_1683.jpg -O q.jpg
'wget' is not recognized as an internal or external command, operable program or batch file.
content_image = load_img('q.jpg')