{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"gpu","dataSources":[{"sourceId":40277,"databundleVersionId":4725531,"sourceType":"competition"}],"dockerImageVersionId":30356,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# NFL YOLOv9 Player Position Detection\n","metadata":{"papermill":{"duration":0.006075,"end_time":"2023-01-22T03:21:00.951142","exception":false,"start_time":"2023-01-22T03:21:00.945067","status":"completed"},"tags":[]}},{"cell_type":"markdown","source":"https://www.kaggle.com/code/stpeteishii/nfl-yolov8-player-position-detection","metadata":{}},{"cell_type":"markdown","source":"https://github.com/rkuo2000/yolov9\n\nhttps://arxiv.org/abs/2402.13616","metadata":{}},{"cell_type":"code","source":"!git clone https://github.com/rkuo2000/yolov9\n\n!wget https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-c.pt","metadata":{"papermill":{"duration":11.427562,"end_time":"2023-01-22T03:21:13.351928","exception":false,"start_time":"2023-01-22T03:21:01.924366","status":"completed"},"tags":[],"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-03-11T04:02:14.774191Z","iopub.execute_input":"2024-03-11T04:02:14.77528Z","iopub.status.idle":"2024-03-11T04:02:17.961803Z","shell.execute_reply.started":"2024-03-11T04:02:14.775239Z","shell.execute_reply":"2024-03-11T04:02:17.9605Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#from ultralytics import YOLO\nimport os\nimport cv2\nimport shutil\nimport numpy as np\nimport pandas as pd\nfrom PIL import Image\nfrom tqdm import tqdm\nfrom IPython.display import HTML, Video, Image, clear_output\nimport seaborn as sns\nimport matplotlib.pyplot as plt\nfrom matplotlib import animation, rc\nrc('animation', html='jshtml')","metadata":{"papermill":{"duration":2.929272,"end_time":"2023-01-22T03:21:16.286215","exception":false,"start_time":"2023-01-22T03:21:13.356943","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:02:17.965012Z","iopub.execute_input":"2024-03-11T04:02:17.9654Z","iopub.status.idle":"2024-03-11T04:02:17.973584Z","shell.execute_reply.started":"2024-03-11T04:02:17.965365Z","shell.execute_reply":"2024-03-11T04:02:17.97237Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Copy Source Movie","metadata":{"papermill":{"duration":0.004505,"end_time":"2023-01-22T03:21:16.295705","exception":false,"start_time":"2023-01-22T03:21:16.2912","status":"completed"},"tags":[]}},{"cell_type":"code","source":"!mkdir -p /kaggle/working/sample1    ### source mp4\n!mkdir -p /kaggle/working/sample2    ### frame images\n!mkdir -p /kaggle/working/sample3    ### fig","metadata":{"papermill":{"duration":1.897872,"end_time":"2023-01-22T03:21:18.198285","exception":false,"start_time":"2023-01-22T03:21:16.300413","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:02:17.974822Z","iopub.execute_input":"2024-03-11T04:02:17.97522Z","iopub.status.idle":"2024-03-11T04:02:21.134803Z","shell.execute_reply.started":"2024-03-11T04:02:17.975189Z","shell.execute_reply":"2024-03-11T04:02:21.133348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"58168_003392_Sideline.mp4","metadata":{}},{"cell_type":"code","source":"path_mp0='/kaggle/input/nfl-player-contact-detection/train/58168_003392_Sideline.mp4'\npath_mp1='/kaggle/working/sample1/sample.mp4'","metadata":{"papermill":{"duration":0.013351,"end_time":"2023-01-22T03:21:18.217927","exception":false,"start_time":"2023-01-22T03:21:18.204576","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:02:21.136514Z","iopub.execute_input":"2024-03-11T04:02:21.136871Z","iopub.status.idle":"2024-03-11T04:02:21.142381Z","shell.execute_reply.started":"2024-03-11T04:02:21.136834Z","shell.execute_reply":"2024-03-11T04:02:21.141219Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"shutil.copy(path_mp0,path_mp1)","metadata":{"papermill":{"duration":0.236828,"end_time":"2023-01-22T03:21:18.459561","exception":false,"start_time":"2023-01-22T03:21:18.222733","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:02:21.145226Z","iopub.execute_input":"2024-03-11T04:02:21.145575Z","iopub.status.idle":"2024-03-11T04:02:21.168701Z","shell.execute_reply.started":"2024-03-11T04:02:21.145544Z","shell.execute_reply":"2024-03-11T04:02:21.167754Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(os.listdir('/kaggle/working'))\nprint(os.listdir('/kaggle/working/sample1'))","metadata":{"papermill":{"duration":0.015571,"end_time":"2023-01-22T03:21:18.481552","exception":false,"start_time":"2023-01-22T03:21:18.465981","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:02:21.169931Z","iopub.execute_input":"2024-03-11T04:02:21.17026Z","iopub.status.idle":"2024-03-11T04:02:21.176028Z","shell.execute_reply.started":"2024-03-11T04:02:21.170233Z","shell.execute_reply":"2024-03-11T04:02:21.175045Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# YOLOv9","metadata":{"papermill":{"duration":0.004826,"end_time":"2023-01-22T03:21:18.492276","exception":false,"start_time":"2023-01-22T03:21:18.48745","status":"completed"},"tags":[]}},{"cell_type":"code","source":"os.chdir('yolov9')","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:02:21.177586Z","iopub.execute_input":"2024-03-11T04:02:21.178218Z","iopub.status.idle":"2024-03-11T04:02:21.190557Z","shell.execute_reply.started":"2024-03-11T04:02:21.178189Z","shell.execute_reply":"2024-03-11T04:02:21.189611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:02:21.192314Z","iopub.execute_input":"2024-03-11T04:02:21.19347Z","iopub.status.idle":"2024-03-11T04:02:22.247237Z","shell.execute_reply.started":"2024-03-11T04:02:21.193426Z","shell.execute_reply":"2024-03-11T04:02:22.245743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install -r requirements.txt","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-03-11T04:02:22.249284Z","iopub.execute_input":"2024-03-11T04:02:22.249732Z","iopub.status.idle":"2024-03-11T04:02:34.439166Z","shell.execute_reply.started":"2024-03-11T04:02:22.249685Z","shell.execute_reply":"2024-03-11T04:02:34.437953Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls  runs/detect","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:02:34.440648Z","iopub.execute_input":"2024-03-11T04:02:34.440967Z","iopub.status.idle":"2024-03-11T04:02:35.501861Z","shell.execute_reply.started":"2024-03-11T04:02:34.440935Z","shell.execute_reply":"2024-03-11T04:02:35.500771Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!rm -rf runs/detect","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:02:35.503432Z","iopub.execute_input":"2024-03-11T04:02:35.503768Z","iopub.status.idle":"2024-03-11T04:02:36.575184Z","shell.execute_reply.started":"2024-03-11T04:02:35.503737Z","shell.execute_reply":"2024-03-11T04:02:36.57375Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"    usage: detect.py [-h] [--weights WEIGHTS [WEIGHTS ...]] [--source SOURCE]\n                     [--data DATA] [--imgsz IMGSZ [IMGSZ ...]]\n                     [--conf-thres CONF_THRES] [--iou-thres IOU_THRES]\n                     [--max-det MAX_DET] [--device DEVICE] [--view-img]\n                     [--save-txt] [--save-conf] [--save-crop] [--nosave]\n                     [--classes CLASSES [CLASSES ...]] [--agnostic-nms]\n                     [--augment] [--visualize] [--update] [--project PROJECT]\n                     [--name NAME] [--exist-ok] [--line-thickness LINE_THICKNESS]\n                     [--hide-labels] [--hide-conf] [--half] [--dnn]\n                     [--vid-stride VID_STRIDE]","metadata":{}},{"cell_type":"code","source":"!python detect.py --weights ../yolov9-c.pt --conf 0.1 --source {path_mp1}  --device 0 --save-txt","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-03-11T04:02:36.576759Z","iopub.execute_input":"2024-03-11T04:02:36.577111Z","iopub.status.idle":"2024-03-11T04:03:32.193124Z","shell.execute_reply.started":"2024-03-11T04:02:36.577077Z","shell.execute_reply":"2024-03-11T04:03:32.191782Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls runs/detect/exp","metadata":{"papermill":{"duration":0.990921,"end_time":"2023-01-22T03:22:23.419294","exception":false,"start_time":"2023-01-22T03:22:22.428373","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:03:32.194918Z","iopub.execute_input":"2024-03-11T04:03:32.195358Z","iopub.status.idle":"2024-03-11T04:03:33.280241Z","shell.execute_reply.started":"2024-03-11T04:03:32.195309Z","shell.execute_reply":"2024-03-11T04:03:33.278922Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_mp2=\"/kaggle/working/yolov9/runs/detect/exp/sample.mp4\"","metadata":{"papermill":{"duration":0.050229,"end_time":"2023-01-22T03:22:23.511493","exception":false,"start_time":"2023-01-22T03:22:23.461264","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:03:33.286475Z","iopub.execute_input":"2024-03-11T04:03:33.286821Z","iopub.status.idle":"2024-03-11T04:03:33.291957Z","shell.execute_reply.started":"2024-03-11T04:03:33.286786Z","shell.execute_reply":"2024-03-11T04:03:33.29097Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls /kaggle/working/sample2/","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:03:33.293611Z","iopub.execute_input":"2024-03-11T04:03:33.293894Z","iopub.status.idle":"2024-03-11T04:03:34.349107Z","shell.execute_reply.started":"2024-03-11T04:03:33.293869Z","shell.execute_reply":"2024-03-11T04:03:34.348044Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def video2frames(video_file=path_mp2, image_dir='/kaggle/working/sample2/', image_file='img_%s.png'):\n    i = 0\n    cap = cv2.VideoCapture(video_file)\n    while(cap.isOpened()):\n        flag, frame = cap.read()\n        if flag == False:\n            break\n        cv2.imwrite(image_dir+image_file % str(i).zfill(5), frame) \n        i += 1\n    cap.release()\n    \nvideo2frames()","metadata":{"papermill":{"duration":80.562651,"end_time":"2023-01-22T03:23:44.20534","exception":false,"start_time":"2023-01-22T03:22:23.642689","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:03:34.350592Z","iopub.execute_input":"2024-03-11T04:03:34.350896Z","iopub.status.idle":"2024-03-11T04:04:15.096266Z","shell.execute_reply.started":"2024-03-11T04:03:34.350865Z","shell.execute_reply":"2024-03-11T04:04:15.09517Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths0=[]\nfor dirname, _, filenames in os.walk('/kaggle/working/sample2/'):\n    for filename in filenames:\n        if filename[-4:]=='.png':\n            paths0+=[(os.path.join(dirname, filename))]\npaths0=sorted(paths0)            \nimages0=[]\nfor i in tqdm(range(len(paths0))):\n    images0+=[cv2.imread(paths0[i])]","metadata":{"papermill":{"duration":16.662056,"end_time":"2023-01-22T03:24:00.909102","exception":false,"start_time":"2023-01-22T03:23:44.247046","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:04:15.097531Z","iopub.execute_input":"2024-03-11T04:04:15.097854Z","iopub.status.idle":"2024-03-11T04:04:32.691278Z","shell.execute_reply.started":"2024-03-11T04:04:15.097818Z","shell.execute_reply":"2024-03-11T04:04:32.690227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def create_animation(ims):\n    fig=plt.figure(figsize=(12,8))\n    im=plt.imshow(cv2.cvtColor(ims[0],cv2.COLOR_BGR2RGB))\n    plt.axis('off')\n    plt.close()\n\n    def animate_func(i):\n        im.set_array(cv2.cvtColor(ims[i],cv2.COLOR_BGR2RGB))\n        return [im]    \n    \n    return animation.FuncAnimation(fig, animate_func, frames=len(ims), interval=1000//10)\n\ncreate_animation(np.array(images0))","metadata":{"papermill":{"duration":60.538302,"end_time":"2023-01-22T03:25:01.495291","exception":false,"start_time":"2023-01-22T03:24:00.956989","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:04:32.692568Z","iopub.execute_input":"2024-03-11T04:04:32.692879Z","iopub.status.idle":"2024-03-11T04:05:27.729637Z","shell.execute_reply.started":"2024-03-11T04:04:32.692852Z","shell.execute_reply":"2024-03-11T04:05:27.728351Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Obtain rectangle information","metadata":{"papermill":{"duration":0.594134,"end_time":"2023-01-22T03:25:02.686456","exception":false,"start_time":"2023-01-22T03:25:02.092322","status":"completed"},"tags":[]}},{"cell_type":"code","source":"paths=[]\nfor dirname, _, filenames in os.walk('/kaggle/working/yolov9/runs/detect/exp/labels'):\n    for filename in filenames:\n        paths+=[(os.path.join(dirname, filename))]","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:05:27.731115Z","iopub.execute_input":"2024-03-11T04:05:27.731493Z","iopub.status.idle":"2024-03-11T04:05:27.744363Z","shell.execute_reply.started":"2024-03-11T04:05:27.731458Z","shell.execute_reply":"2024-03-11T04:05:27.742543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"result0=[]\nfor path in paths:\n    order=path.split('/')[-1].split('_')[-1].split('.')[0].zfill(4)\n    anno=pd.read_csv(path,sep=' ',header=None)\n    for i in range(len(anno)):\n        label=anno.iloc[i,0]\n        a=anno.iloc[i,1]\n        b=anno.iloc[i,2]        \n        c=anno.iloc[i,3]\n        d=anno.iloc[i,4] \n        result0+=[[a,b,c,d,label,order]]","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"BOX=pd.DataFrame(data=result0,columns=['x','y','x2','y2','class','i'])\ndisplay(BOX)","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:05:27.745927Z","iopub.execute_input":"2024-03-11T04:05:27.746291Z","iopub.status.idle":"2024-03-11T04:05:49.120411Z","shell.execute_reply.started":"2024-03-11T04:05:27.746263Z","shell.execute_reply":"2024-03-11T04:05:49.119072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"    BOX=pd.DataFrame(columns=range(6))\n    for i in range(len(results)):\n        arri=pd.DataFrame(results[i].boxes.boxes).astype(float)\n        arri['i']=i\n        BOX=pd.concat([BOX,arri],axis=0)\n    BOX.columns=['x','y','x2','y2','confidence','class','i']\n    display(BOX)","metadata":{"papermill":{"duration":3.033841,"end_time":"2023-01-22T03:25:42.855432","exception":false,"start_time":"2023-01-22T03:25:39.821591","status":"completed"},"tags":[],"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-03-11T02:42:00.90655Z","iopub.status.idle":"2024-03-11T02:42:00.907207Z","shell.execute_reply.started":"2024-03-11T02:42:00.906903Z","shell.execute_reply":"2024-03-11T02:42:00.906929Z"}}},{"cell_type":"code","source":"class_map = {0: u'__background__', 1: u'person', 2: u'bicycle',3: u'car', 4: u'motorcycle', 5: u'airplane', 6: u'bus', 7: u'train', 8: u'truck', 9: u'boat', 10: u'traffic light', 11: u'fire hydrant', 12: u'stop sign', 13: u'parking meter', 14: u'bench', 15: u'bird', 16: u'cat', 17: u'dog', 18: u'horse', 19: u'sheep', 20: u'cow', 21: u'elephant', 22: u'bear', 23: u'zebra', 24: u'giraffe', 25: u'backpack', 26: u'umbrella', 27: u'handbag', 28: u'tie', 29: u'suitcase', 30: u'frisbee', 31: u'skis', 32: u'snowboard', 33: u'sports ball', 34: u'kite', 35: u'baseball bat', 36: u'baseball glove', 37: u'skateboard', 38: u'surfboard', 39: u'tennis racket', 40: u'bottle', 41: u'wine glass', 42: u'cup', 43: u'fork', 44: u'knife', 45: u'spoon', 46: u'bowl', 47: u'banana', 48: u'apple', 49: u'sandwich', 50: u'orange', 51: u'broccoli', 52: u'carrot', 53: u'hot dog', 54: u'pizza', 55: u'donut', 56: u'cake', 57: u'chair', 58: u'couch', 59: u'potted plant', 60: u'bed', 61: u'dining table', 62: u'toilet', 63: u'tv', 64: u'laptop', 65: u'mouse', 66: u'remote', 67: u'keyboard', 68: u'cell phone', 69: u'microwave', 70: u'oven', 71: u'toaster', 72: u'sink', 73: u'refrigerator', 74: u'book', 75: u'clock', 76: u'vase', 77: u'scissors', 78: u'teddy bear', 79: u'hair drier', 80: u'toothbrush'}","metadata":{"papermill":{"duration":0.607278,"end_time":"2023-01-22T03:25:44.049923","exception":false,"start_time":"2023-01-22T03:25:43.442645","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:05:49.121391Z","iopub.status.idle":"2024-03-11T04:05:49.121795Z","shell.execute_reply.started":"2024-03-11T04:05:49.121606Z","shell.execute_reply":"2024-03-11T04:05:49.121625Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"BOX['class']=BOX['class'].apply(lambda x: class_map[int(x)+1])\nBOX=BOX.reset_index(drop=True)\ndisplay(BOX)\ndisplay(BOX['class'].value_counts())","metadata":{"papermill":{"duration":0.640078,"end_time":"2023-01-22T03:25:45.280192","exception":false,"start_time":"2023-01-22T03:25:44.640114","status":"completed"},"tags":[],"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-03-11T04:05:49.123794Z","iopub.status.idle":"2024-03-11T04:05:49.124218Z","shell.execute_reply.started":"2024-03-11T04:05:49.124035Z","shell.execute_reply":"2024-03-11T04:05:49.124053Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data0=BOX[BOX['class']=='person'] #[BOX['confidence']>0.1]\ndata0['i']=data0['i'].apply(lambda x: int(x))\ndata0['y']=data0['y'].apply(lambda y: -y)\ndata0=data0.reset_index(drop=True)\ndata0['j']=data0.index.tolist()\ndisplay(data0)\nprint(len(data0))\ndata0.to_csv('data0.csv',index=False)","metadata":{"papermill":{"duration":0.637652,"end_time":"2023-01-22T03:25:46.4989","exception":false,"start_time":"2023-01-22T03:25:45.861248","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:05:49.126061Z","iopub.status.idle":"2024-03-11T04:05:49.126434Z","shell.execute_reply.started":"2024-03-11T04:05:49.126253Z","shell.execute_reply":"2024-03-11T04:05:49.12627Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom plotly.subplots import make_subplots","metadata":{"papermill":{"duration":3.225343,"end_time":"2023-01-22T03:25:50.340798","exception":false,"start_time":"2023-01-22T03:25:47.115455","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2024-03-11T04:05:49.12792Z","iopub.status.idle":"2024-03-11T04:05:49.128293Z","shell.execute_reply.started":"2024-03-11T04:05:49.12812Z","shell.execute_reply":"2024-03-11T04:05:49.128136Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(data0['x'].min(),data0['x'].max())\nprint(data0['y'].min(),data0['y'].max())","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:05:49.129747Z","iopub.status.idle":"2024-03-11T04:05:49.130144Z","shell.execute_reply.started":"2024-03-11T04:05:49.129933Z","shell.execute_reply":"2024-03-11T04:05:49.12995Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"iss=sorted(data0['i'].unique().tolist())","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for i in iss:\n    ax=sns.scatterplot(data=data0[data0['i']==i], x=\"x\", y=\"y\", palette=\"Paired\") \n    plt.title(\"Player Positions \"+str(i).zfill(4))\n    ax.set_xlim([0, 1])\n    ax.set_ylim([-1, 0])\n    plt.savefig('/kaggle/working/sample3/fig_'+str(i).zfill(4)+'.png')\n    plt.close()","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:05:49.131172Z","iopub.status.idle":"2024-03-11T04:05:49.131527Z","shell.execute_reply.started":"2024-03-11T04:05:49.131349Z","shell.execute_reply":"2024-03-11T04:05:49.131366Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths3=[]\nfor dirname, _, filenames in os.walk('/kaggle/working/sample3/'):\n    for filename in filenames:\n        if filename[-4:]=='.png':\n            paths3+=[(os.path.join(dirname, filename))]\npaths3=sorted(paths3)\nprint(paths3[100:103])\nimages1=[]\nfor i in tqdm(range(0,len(paths3),2)):\n    images1+=[cv2.imread(paths3[i])]","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:05:49.133049Z","iopub.status.idle":"2024-03-11T04:05:49.133431Z","shell.execute_reply.started":"2024-03-11T04:05:49.13324Z","shell.execute_reply":"2024-03-11T04:05:49.133257Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"create_animation(np.array(images1))","metadata":{"execution":{"iopub.status.busy":"2024-03-11T04:05:49.135259Z","iopub.status.idle":"2024-03-11T04:05:49.135599Z","shell.execute_reply.started":"2024-03-11T04:05:49.13543Z","shell.execute_reply":"2024-03-11T04:05:49.135445Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"papermill":{"duration":0.574092,"end_time":"2023-01-22T03:25:54.154549","exception":false,"start_time":"2023-01-22T03:25:53.580457","status":"completed"},"tags":[]},"execution_count":null,"outputs":[]}]}