{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/9675","repository_url":"https://api.github.com/repos/tensorflow/tensorflow","labels_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/9675/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/9675/comments","events_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/9675/events","html_url":"https://github.com/tensorflow/tensorflow/issues/9675","id":226460535,"number":9675,"title":"The tfrecords file is 8 times larger than raw image data","user":{"login":"daiab","id":16236576,"avatar_url":"https://avatars3.githubusercontent.com/u/16236576?v=3","gravatar_id":"","url":"https://api.github.com/users/daiab","html_url":"https://github.com/daiab","followers_url":"https://api.github.com/users/daiab/followers","following_url":"https://api.github.com/users/daiab/following{/other_user}","gists_url":"https://api.github.com/users/daiab/gists{/gist_id}","starred_url":"https://api.github.com/users/daiab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daiab/subscriptions","organizations_url":"https://api.github.com/users/daiab/orgs","repos_url":"https://api.github.com/users/daiab/repos","events_url":"https://api.github.com/users/daiab/events{/privacy}","received_events_url":"https://api.github.com/users/daiab/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2017-05-05T02:55:57Z","updated_at":"2017-05-19T16:11:29Z","closed_at":"2017-05-06T17:58:20Z","body":"I try to write a tfrecords file, but the file is larger than raw data. \r\n```python (type)\r\nimg = Image.open('img_file')  # this image file size: 24 kb\r\nb = img.tobytes()  # the len(b) is 24 kb, this is right\r\nfeats = tf.train.Features(feature={'label': tf.train.Feature(int64_list=tf.train.Int64List(value=[2])), \r\n'image_raw': tf.train.Feature(bytes_list=tf.train.BytesList(value=[b]))})\r\nexample_string = example.SerializeToString()\r\nlen(example_string) / 8 / 1024  # the output == 24.0057373046875 kb, look like well\r\n```\r\nbut I write this 'example_string' to tfrecords file , the tfrecords file size become 192 kb, I cann`t understand why tfrecords file size serval times larger than 'example_string' and raw image data"},"comment":{"url":"https://api.github.com/repos/tensorflow/tensorflow/issues/comments/302745553","html_url":"https://github.com/tensorflow/tensorflow/issues/9675#issuecomment-302745553","issue_url":"https://api.github.com/repos/tensorflow/tensorflow/issues/9675","id":302745553,"user":{"login":"ppwwyyxx","id":1381301,"avatar_url":"https://avatars0.githubusercontent.com/u/1381301?v=3","gravatar_id":"","url":"https://api.github.com/users/ppwwyyxx","html_url":"https://github.com/ppwwyyxx","followers_url":"https://api.github.com/users/ppwwyyxx/followers","following_url":"https://api.github.com/users/ppwwyyxx/following{/other_user}","gists_url":"https://api.github.com/users/ppwwyyxx/gists{/gist_id}","starred_url":"https://api.github.com/users/ppwwyyxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ppwwyyxx/subscriptions","organizations_url":"https://api.github.com/users/ppwwyyxx/orgs","repos_url":"https://api.github.com/users/ppwwyyxx/repos","events_url":"https://api.github.com/users/ppwwyyxx/events{/privacy}","received_events_url":"https://api.github.com/users/ppwwyyxx/received_events","type":"User","site_admin":false},"created_at":"2017-05-19T16:11:29Z","updated_at":"2017-05-19T16:11:29Z","body":"TFRecord stores bytes so you can do any encoding you want.\r\nThe easiest thing you can do is just `img_raw = open(img_path).read()` to use the original encoding.\r\nThe decompression time is usually much smaller than training, and could be completely hidden if the preprocessing runs in parallel with training.\r\n"}}
{"actor":{"display_login":"ppwwyyxx"}}