a30c31849a1ce6791ad201f09507c2f2dfe6db27,tensorflow_datasets/core/features/image_feature.py,Image,encode_sample,#Image#Any#,103
Before Change
def encode_sample (self, image_or_path) :
Convert the given image into a dict convertible to tf example.
if isinstance (image_or_path, six.string_types) :
raise NotImplementedError
elif isinstance (image_or_path, np.ndarray) :
np_image = image_or_path
else :
raise ValueError ("Could not convert {} to image" .format(image_or_path) )
if np_image.dtype ! = np.uint8:
raise ValueError ("Image should be uint8. Detected: {}" .format(
np_image.dtype) )
utils.assert_shape_match (np_image.shape, self._shape)
After Change
encoded_image = self._encode_image(image_or_path)
else :
with tf.gfile.Open(image_or_path, "rb" ) as image_f:
encoded_image = image_f.read()
return encoded_image
def decode_sample (self, sample) :
Reconstruct the image from the tf example.
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: tensorflow/datasets
Commit Name: a30c31849a1ce6791ad201f09507c2f2dfe6db27
Time: 2018-11-08
Author: pierrot@google.com
File Name: tensorflow_datasets/core/features/image_feature.py
Class Name: Image
Method Name: encode_sample
Project Name: prody/ProDy
Commit Name: e93f4d4dcd70fc3eaf87779fc9f0b34f98e04ac8
Time: 2012-10-17
Author: lordnapi@gmail.com
File Name: lib/prody/utilities/pathtools.py
Class Name:
Method Name: gunzip
Project Name: tyarkoni/pliers
Commit Name: 883c79196544b9e7e032bd2f6ea23cf175cfeb4c
Time: 2016-11-22
Author: tyarkoni@gmail.com
File Name: featurex/stimuli/audio.py
Class Name: TranscribedAudioStim
Method Name: __init__