Skip to content

Instantly share code, notes, and snippets.

@prerakmody
Created April 4, 2018 10:01
Show Gist options
  • Save prerakmody/d3354fd71b238031a9deb35f355ee337 to your computer and use it in GitHub Desktop.
Save prerakmody/d3354fd71b238031a9deb35f355ee337 to your computer and use it in GitHub Desktop.
img_url = '/home/play/data/GOD_DATASET/open_datasets/cityscapes/gtFine_trainvaltest/gtFine/train/aachen/aachen_000000_000019_gtFine_color.png'
# img_url = '/home/play/data/GOD_DATASET/open_datasets/mapillary/mapillary-vistas-dataset_public_v1.0/training/instances/QOJJHmXYAiRVW3rDK3gs0g.png'
import cv2
import skimage.io
import numpy as np
img = cv2.imread(img_url,cv2.IMREAD_UNCHANGED)
print ('\nCV2 : ', np.unique(img))
img = skimage.io.imread(img_url)
print ('\nskimage : ', np.unique(img))
import tensorflow as tf
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
img = tf.image.decode_png(tf.read_file(img_url), channels=1)
with tf.Session() as sess:
img = sess.run([img])
print ('\ntensorflow : ', np.unique(img))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment