<jupyter_start><jupyter_text>Create class to id dictionary<jupyter_code>cat = data['categories'] #list of categories - 80 categories
COCO_COMMONCLS_ID = {}
COCO_ID_COMMONCLS = {}
for i in cat:
    if i['name'] in COMMON_CLASSES:
        COCO_COMMONCLS_ID[i['name']]=i['id']
        COCO_ID_COMMONCLS[i['id']]=i['name']
print(COCO_COMMONCLS_ID, COCO_ID_COMMONCLS)
data1 = data['annotations']
smpl = data1[2342]
smpl
import cv2

%matplotlib inline
from matplotlib import pyplot as plt
print(smpl.keys()); smplbbox = smpl['bbox'];
smpl['image_id']
data_img[0]
smpl_data = {}
for i in data_img:
    if i['id']==smpl['image_id']:
        smpl_data = i
img_path = "/new_data/gpu/utkrsh/MSCOCO/train2014/"
smpl_img_file = img_path+smpl_data['file_name']<jupyter_output><empty_output><jupyter_text>Image with bounding box should appear<jupyter_code>import numpy as np
image = cv2.imread(smpl_img_file, cv2.IMREAD_COLOR)
colors = plt.cm.hsv(np.linspace(0, 1, 21)).tolist()
rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
plt.figure(figsize=(10,10))
plt.imshow(rgb_image)
cd = smpl['bbox']

currentAxis = plt.gca()
currentAxis.add_patch(plt.Rectangle((cd[0],cd[1]),cd[2],cd[3],
                                        fill=False, edgecolor=colors[15], linewidth=2))
    
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14877300613496933, 'fraction_numerical': 0.02607361963190184, 'mean_word_length': 5.304347826086956, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '295303', 'license': 'MIT', 'n_tokens_mistral': 545, 'n_tokens_neox': 534, 'n_words': 87, 'path': 'MSCOCO Preprocessing.ipynb', 'repo_name': 'chauhan-utk/ssd.DomainAdaptation', 'size': '1304'}