Skip to content

Instantly share code, notes, and snippets.

@falahgs
Created May 28, 2021 08:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falahgs/0069c19ed50e44056358d2a0727c503c to your computer and use it in GitHub Desktop.
Save falahgs/0069c19ed50e44056358d2a0727c503c to your computer and use it in GitHub Desktop.
Image Captionng
with open('open_images_train_captions.jsonl', 'r') as json_file:
json_list = json_file.read().split('\n')
np.random.shuffle(json_list)
data = []
N = 100000
for ix, json_str in Tqdm(enumerate(json_list), N):
if ix == N: break
try:
result = json.loads(json_str)
x = pd.DataFrame.from_dict(result, orient='index').T
data.append(x)
except:
pass
@falahgs
Copy link
Author

falahgs commented May 28, 2021

update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment