MCPcopy Create free account
hub / github.com/tensorflow/datasets / get_random_jpeg

Function get_random_jpeg

tensorflow_datasets/testing/fake_data_utils.py:40–49  ·  view source on GitHub ↗

Returns path to JPEG picture.

(height=None, width=None, channels=CHANNELS_NB)

Source from the content-addressed store, hash-verified

38
39
40def get_random_jpeg(height=None, width=None, channels=CHANNELS_NB):
41 """Returns path to JPEG picture."""
42 image = get_random_picture(height, width, channels)
43 jpeg = tf.image.encode_jpeg(image)
44 with utils.nogpu_session() as sess:
45 res = sess.run(jpeg)
46 fobj = tempfile.NamedTemporaryFile(delete=False, mode='wb', suffix='.JPEG')
47 fobj.write(res)
48 fobj.close()
49 return fobj.name
50
51
52def get_random_png(height=None, width=None, channels=CHANNELS_NB):

Callers

nothing calls this directly

Calls 4

get_random_pictureFunction · 0.85
runMethod · 0.80
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected