<jupyter_start><jupyter_text><jupyter_code>from pycocotools.coco import COCO
!pwd<jupyter_output><empty_output><jupyter_text>New Section<jupyter_code># !wget http://images.cocodataset.org/zips/train2017.zip
!wget http://images.cocodataset.org/annotations/annotations_trainval2014.zip
!unzip annotations_trainval2014.zip
coco = COCO('annotations/instances_train2014.json')
coco.getCatIds(['person'])
img_ids = coco.getImgIds(catIds=[1])
len(img_ids), img_ids[:5]
# import cv2
# from google.colab.patches import cv2_imshow

# for img_id in img_ids[:5]:
#   jpg = f'{img_id:012d}.jpg'
#   url = f'http://images.cocodataset.org/train2014/{jpg}'
#   !wget $url -O $jpg
#   im = cv2.imread(jpg)
#   cv2_imshow(im)
coco.download('.', imgIds=img_ids[:5])
!ls
import glob, cv2
from google.colab.patches import cv2_imshow
for img in glob.glob('COCO*.jpg'):
  img = cv2.imread(img)
  cv2_imshow(img)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15250544662309368, 'fraction_numerical': 0.03812636165577342, 'mean_word_length': 6.411290322580645, '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': '601359', 'license': 'MIT', 'n_tokens_mistral': 402, 'n_tokens_neox': 380, 'n_words': 57, 'path': 'colab/coco_Scratch.ipynb', 'repo_name': 'tgandor/urban_oculus', 'size': '918'}