|
import tensorflow as tf |
|
import base64 |
|
from PIL import Image |
|
import io |
|
from tqdm import tqdm |
|
|
|
filenames = tf.io.gfile.glob('./android_control*') |
|
raw_dataset = tf.data.TFRecordDataset(filenames, compression_type='GZIP') |
|
dataset_iterator = tf.compat.v1.data.make_one_shot_iterator(raw_dataset) |
|
|
|
|
|
for data in tqdm(dataset_iterator): |
|
example = tf.train.Example.FromString(data.numpy()) |
|
episode_id = example.features.feature['episode_id'].int64_list.value |
|
|
|
for i, image_data in enumerate(screenshots): |
|
image = Image.open(io.BytesIO(image_data)) |
|
image.save(f"./images/android_control_episode_{str(episode_id)}_{str(i)}.png") |
|
|