application_vnd.jupyter.stderr_output_3.png text_plain_output_2.png application_vnd.jupyter.stderr_output_1.png
from PIL import Image

from tqdm import tqdm

import json

import os

import torch
from torch.utils.data import DataLoader
import torchvision
import torchvision.transforms as T
from torchvision.io import read_image, ImageReadMode
from sklearn.model_selection import train_test_split
import os
import json
from tqdm import tqdm
from PIL import Image
import matplotlib.pyplot as plt
import random
Image.MAX_IMAGE_PIXELS = None

ds_path = '/kaggle/input/raw-mmimdb/mmimdb/dataset/'
ids = list(set([x.split('.')[0] for x in os.listdir(ds_path)]))

img = f'{ds_path}{ids[0]}.jpeg'
meta = f'{ds_path}{ids[0]}.json'
Image.open(img)

with open(meta, 'r') as f:
    metadata = json.load(f)

horror_ids = []
drama_ids = []
for id in tqdm(ids):
    metadata_file = f'{ds_path}{id}.json'
    with open(metadata_file, 'r') as f:
        metadata = json.load(f)
    genres = metadata['genres']
    if 'Horror' in genres and 'Drama' not in genres:
        horror_ids.append(id)
    if 'Drama' in genres and 'Horror' not in genres:
        drama_ids.append(id)