diff --git a/colab/B-1B Lancer Heavy Bombers at Aero India 2023.mp4 b/colab/B-1B Lancer Heavy Bombers at Aero India 2023.mp4
new file mode 100644
index 00000000..9f9cd0bb
Binary files /dev/null and b/colab/B-1B Lancer Heavy Bombers at Aero India 2023.mp4 differ
diff --git a/colab/Output_vedio201.avi b/colab/Output_vedio201.avi
new file mode 100644
index 00000000..64f471b8
Binary files /dev/null and b/colab/Output_vedio201.avi differ
diff --git a/colab/lama_Video_inpainting.ipynb b/colab/lama_Video_inpainting.ipynb
new file mode 100644
index 00000000..b6b70d74
--- /dev/null
+++ b/colab/lama_Video_inpainting.ipynb
@@ -0,0 +1 @@
+{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[]},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"},"accelerator":"GPU","gpuClass":"standard"},"cells":[{"cell_type":"markdown","source":["**Try inpainting on video yourself**"],"metadata":{"id":"wh9TMP6ZpyzK"}},{"cell_type":"code","execution_count":1,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"77fdT4VTSgL7","outputId":"68c4ab08-1bcd-468e-f2c9-a41d1d64f581","executionInfo":{"status":"ok","timestamp":1681743165576,"user_tz":-330,"elapsed":783995,"user":{"displayName":"Sri Om Subham (M22AI836)","userId":"00908540382614000284"}}},"outputs":[{"output_type":"stream","name":"stdout","text":["\n","> Cloning the repo\n","Cloning into 'lama'...\n","remote: Enumerating objects: 399, done.\u001b[K\n","remote: Counting objects: 100% (128/128), done.\u001b[K\n","remote: Compressing objects: 100% (70/70), done.\u001b[K\n","remote: Total 399 (delta 76), reused 68 (delta 55), pack-reused 271\u001b[K\n","Receiving objects: 100% (399/399), 9.87 MiB | 15.06 MiB/s, done.\n","Resolving deltas: 100% (138/138), done.\n","\n","> Install dependencies\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Collecting torch==1.8.0\n"," Downloading torch-1.8.0-cp39-cp39-manylinux1_x86_64.whl (735.5 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m735.5/735.5 MB\u001b[0m \u001b[31m1.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting torchvision==0.9.0\n"," Downloading torchvision-0.9.0-cp39-cp39-manylinux1_x86_64.whl (17.3 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m17.3/17.3 MB\u001b[0m \u001b[31m53.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting torchaudio==0.8.0\n"," Downloading torchaudio-0.8.0-cp39-cp39-manylinux1_x86_64.whl (1.9 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.9/1.9 MB\u001b[0m \u001b[31m55.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hCollecting torchtext==0.9\n"," Downloading torchtext-0.9.0-cp39-cp39-manylinux1_x86_64.whl (7.0 MB)\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m7.0/7.0 MB\u001b[0m \u001b[31m58.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25hRequirement already satisfied: numpy in /usr/local/lib/python3.9/dist-packages (from torch==1.8.0) (1.22.4)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.9/dist-packages (from torch==1.8.0) (4.5.0)\n","Requirement already satisfied: pillow>=4.1.1 in /usr/local/lib/python3.9/dist-packages (from torchvision==0.9.0) (8.4.0)\n","Requirement already satisfied: tqdm in /usr/local/lib/python3.9/dist-packages (from torchtext==0.9) (4.65.0)\n","Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (from torchtext==0.9) (2.27.1)\n","Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.9/dist-packages (from requests->torchtext==0.9) (2.0.12)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/dist-packages (from requests->torchtext==0.9) (2022.12.7)\n","Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests->torchtext==0.9) (1.26.15)\n","Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests->torchtext==0.9) (3.4)\n","Installing collected packages: torch, torchvision, torchtext, torchaudio\n"," Attempting uninstall: torch\n"," Found existing installation: torch 2.0.0+cu118\n"," Uninstalling torch-2.0.0+cu118:\n"," Successfully uninstalled torch-2.0.0+cu118\n"," Attempting uninstall: torchvision\n"," Found existing installation: torchvision 0.15.1+cu118\n"," Uninstalling torchvision-0.15.1+cu118:\n"," Successfully uninstalled torchvision-0.15.1+cu118\n"," Attempting uninstall: torchtext\n"," Found existing installation: torchtext 0.15.1\n"," Uninstalling torchtext-0.15.1:\n"," Successfully uninstalled torchtext-0.15.1\n"," Attempting uninstall: torchaudio\n"," Found existing installation: torchaudio 2.0.1+cu118\n"," Uninstalling torchaudio-2.0.1+cu118:\n"," Successfully uninstalled torchaudio-2.0.1+cu118\n","\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n","torchdata 0.6.0 requires torch==2.0.0, but you have torch 1.8.0 which is incompatible.\u001b[0m\u001b[31m\n","\u001b[0mSuccessfully installed torch-1.8.0 torchaudio-0.8.0 torchtext-0.9.0 torchvision-0.9.0\n"," Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m29.8/29.8 MB\u001b[0m \u001b[31m16.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m23.8/23.8 MB\u001b[0m \u001b[31m60.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m72.2/72.2 kB\u001b[0m \u001b[31m7.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m144.6/144.6 kB\u001b[0m \u001b[31m17.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m841.9/841.9 kB\u001b[0m \u001b[31m60.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m271.5/271.5 kB\u001b[0m \u001b[31m26.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m51.9/51.9 kB\u001b[0m \u001b[31m6.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m112.4/112.4 kB\u001b[0m \u001b[31m12.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m74.7/74.7 kB\u001b[0m \u001b[31m9.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m176.9/176.9 kB\u001b[0m \u001b[31m20.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m65.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m114.2/114.2 kB\u001b[0m \u001b[31m8.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m264.6/264.6 kB\u001b[0m \u001b[31m25.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m158.8/158.8 kB\u001b[0m \u001b[31m18.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h Building wheel for easydict (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Building wheel for scikit-image (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Building wheel for antlr4-python3-runtime (setup.py) ... \u001b[?25l\u001b[?25hdone\n","\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n","yellowbrick 1.5 requires scikit-learn>=1.0.0, but you have scikit-learn 0.24.2 which is incompatible.\n","imbalanced-learn 0.10.1 requires scikit-learn>=1.0.2, but you have scikit-learn 0.24.2 which is incompatible.\u001b[0m\u001b[31m\n","\u001b[0m Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n"," Building wheel for wget (setup.py) ... \u001b[?25l\u001b[?25hdone\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 GB\u001b[0m \u001b[31m846.3 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m17.6/17.6 MB\u001b[0m \u001b[31m78.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n","torchdata 0.6.0 requires torch==2.0.0, but you have torch 1.8.0+cu111 which is incompatible.\u001b[0m\u001b[31m\n","\u001b[0m\n","> Changing the dir to:\n","/content/lama\n","\n","> Download the model\n"," % Total % Received % Xferd Average Speed Time Time Time Current\n"," Dload Upload Total Spent Left Speed\n"," 0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0\n","100 363M 0 363M 0 0 9843k 0 --:--:-- 0:00:37 --:--:-- 9.9M\n","Archive: big-lama.zip\n"," inflating: big-lama/config.yaml \n"," inflating: big-lama/models/best.ckpt \n",">fixing opencv\n","\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m42.9/42.9 MB\u001b[0m \u001b[31m11.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n","\u001b[?25h\n","> Init mask-drawing code\n"]}],"source":["#@title Run this sell to set everything up\n","print('\\n> Cloning the repo')\n","!git clone https://github.com/advimman/lama.git\n","\n","print('\\n> Install dependencies')\n","!pip install torch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 torchtext==0.9\n","!pip install -r lama/requirements.txt --quiet\n","!pip install wget --quiet\n","!pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html --quiet\n","\n","\n","print('\\n> Changing the dir to:')\n","%cd /content/lama\n","\n","print('\\n> Download the model')\n","!curl -L $(yadisk-direct https://disk.yandex.ru/d/ouP6l8VJ0HpMZg) -o big-lama.zip\n","!unzip big-lama.zip\n","\n","print('>fixing opencv')\n","!pip uninstall opencv-python-headless -y --quiet\n","!pip install opencv-contrib-python-headless==4.4.0.46 --quiet\n","#!pip install opencv-contrib-python-headless==4.1.2.30\n","\n","\n","print('\\n> Init mask-drawing code')\n","import base64, os\n","from IPython.display import HTML, Image\n","from google.colab.output import eval_js\n","from base64 import b64decode\n","import matplotlib.pyplot as plt\n","import numpy as np\n","import wget\n","from shutil import copyfile\n","import shutil\n","import cv2 as cv\n","\n","\n","canvas_html = \"\"\"\n","\n","\n","\n","\n","\n","\n","\n","\"\"\"\n","\n","def draw(imgm, filename='drawing.png', w=400, h=200, line_width=1):\n"," display(HTML(canvas_html % (w, h, w,h, filename.split('.')[-1], imgm, line_width)))\n"," data = eval_js(\"data\")\n"," binary = b64decode(data.split(',')[1])\n"," with open(filename, 'wb') as f:\n"," f.write(binary)"]},{"cell_type":"code","source":["# print the mask and mask*image\n","def show_image(frame1, mask):\n"," plt.figure(figsize=(18,6))\n"," plt.subplot(131)\n"," plt.imshow(mask, cmap='gray')\n"," plt.axis('off')\n"," plt.title('mask')\n"," \n"," plt.subplot(132)\n"," img = np.array(plt.imread(frame1)[:,:,:3]) # image is defined\n"," plt.imshow(img)\n"," plt.axis('off')\n"," plt.title('img')\n","\n"," plt.subplot(133)\n"," img = np.array((1-mask.reshape(mask.shape[0], mask.shape[1], -1))*plt.imread(frame1)[:,:,:3]) # image with mask is defined\n"," _=plt.imshow(img)\n"," _=plt.axis('off')\n"," _=plt.title('img * mask')\n"," plt.show()"],"metadata":{"id":"ZPzCaW-rhxtD","executionInfo":{"status":"ok","timestamp":1681743165577,"user_tz":-330,"elapsed":26,"user":{"displayName":"Sri Om Subham (M22AI836)","userId":"00908540382614000284"}}},"execution_count":2,"outputs":[]},{"cell_type":"code","source":["def run_impainting():\n"," print('Run inpainting')\n"," !PYTHONPATH=. TORCH_HOME=$(pwd) python3 bin/predict.py model.path=$(pwd)/big-lama indir=$(pwd)/data_image outdir=/content/output dataset.img_suffix=.png > /dev/null\n"],"metadata":{"id":"qRgig-vrzUbp","executionInfo":{"status":"ok","timestamp":1681743165578,"user_tz":-330,"elapsed":23,"user":{"displayName":"Sri Om Subham (M22AI836)","userId":"00908540382614000284"}}},"execution_count":3,"outputs":[]},{"cell_type":"markdown","source":["Predefined video : uncomment any line,\n","Local file: leave the vname = None"],"metadata":{"id":"llvXLQLFTy02"}},{"cell_type":"code","source":["shutil.rmtree('./data_for_prediction', ignore_errors=True) # remove any previously present folder/directory\n","!mkdir data_for_prediction # creating the folder/directory\n","\n","vname = None\n","vname = 'colab/B-1B Lancer Heavy Bombers at Aero India 2023.mp4' # <-in the example \n","shutil.copy(vname, './data_for_prediction/B-1B Lancer Heavy Bombers at Aero India 2023.mp4')\n","vanme = f'./data_for_prediction/B-1B Lancer Heavy Bombers at Aero India 2023.mp4'\n","\n","# un-comment the below lines for uploading the video\n","# if vname is None:\n","# from google.colab import files\n","# files = files.upload() # create option to upload the file\n","# vname = list(files.keys())[0] # saves the file in 'vname'\n","\n","\n","# #coping the video file in directory 'data_for_prediction'\n","\n","#copyfile(vname, f'./data_for_prediction/{vname}') # copying the file in the created folder\n","#os.remove(vname) # removing the instance of the file from 'fname'\n","#vname = f'./data_for_prediction/{vname}' # reading the file form the folder"],"metadata":{"id":"CmuULiPQTxQi","executionInfo":{"status":"ok","timestamp":1681744006105,"user_tz":-330,"elapsed":10,"user":{"displayName":"Sri Om Subham (M22AI836)","userId":"00908540382614000284"}}},"execution_count":14,"outputs":[]},{"cell_type":"code","source":["# video details \n","def video_fps():\n"," video = cv.VideoCapture(vname);\n"," # Find OpenCV version\n"," (major_ver, minor_ver, subminor_ver) = (cv.__version__).split('.')\n"," \n"," fps = video.get(cv.CAP_PROP_FPS)\n"," return fps\n","\n"," video.release()\n","\n","def frame_size():\n"," vcap = cv.VideoCapture(vname) \n"," \n"," if vcap.isOpened(): \n"," # get vcap property \n"," width = int(vcap.get(3)) # float `width`\n"," height = int(vcap.get(4)) # float `height`\n","\n"," return [width, height]"],"metadata":{"id":"6XIizns9EQHL","executionInfo":{"status":"ok","timestamp":1681744021999,"user_tz":-330,"elapsed":552,"user":{"displayName":"Sri Om Subham (M22AI836)","userId":"00908540382614000284"}}},"execution_count":15,"outputs":[]},{"cell_type":"markdown","source":["Draw a Mask, Press Finish, Wait for Inpainting"],"metadata":{"id":"HPUVXxD3DMLX"}},{"cell_type":"code","source":["shutil.rmtree('/content/lama/data_image', ignore_errors=True) # remove any previously present folder/directory\n","!mkdir data_image # creating the folder/directory\n","i = 0\n","cap1 = cv.VideoCapture(vname) # path of the first inferenced video\n","\n","while True:\n"," ret1, frame1 = cap1.read() # reading the video 1\n"," \n"," if not ret1: # break for last frame.\n"," break\n","\n"," # push the first frame to draw function\n"," if (i==0):\n"," i = i+1\n"," plt.imsave(\"frame1.png\",frame1) # save the mask in the directory\n","\n"," frame = '/content/lama/frame1.png'\n","\n"," image64 = base64.b64encode(open(frame, 'rb').read()) # converting the file into string of base 64 format\n"," image64 = image64.decode('utf-8') # decoding from string format to utf-8 format\n"," \n"," print(f'Will use {frame} for inpainting')\n"," img = np.array(plt.imread(frame)[:,:,:3]) # reading the image from the folder, converting it into numpy array format.\n"," \n"," draw(image64, filename=\"frame1_mask.png\", w=img.shape[1], h=img.shape[0], line_width=0.04*img.shape[1])\n"," \n"," with_mask = np.array(plt.imread(f\"frame1_mask.png\")[:,:,:3])\n"," mask = (with_mask[:,:,0]==1)*(with_mask[:,:,1]==0)*(with_mask[:,:,2]==0) # mask is defined\n"," \n"," plt.imsave(\"frame1_mask.png\",mask, cmap='gray') # save the mask in the directory\n"," \n"," show_image(frame, mask) # displating mask, image , image*mask\n"," \n"," # saving images and masks for runing impainting\n"," plt.imsave(f\"./data_image/frame{i}.png\",frame1)\n"," mask = plt.imread('/content/lama/frame1_mask.png')\n"," plt.imsave(f\"./data_image/frame{i}_mask.png\", mask, cmap='gray')\n"," i = i+1\n"," \n","cap1.release()\n","run_impainting()\n","print ('Impainting completed')\n","\n","# make video form the images\n","print ('combining frames to make video')\n","out = cv.VideoWriter('Output_video_su30mki.avi', cv.VideoWriter_fourcc(*'MJPG'), video_fps(), (frame_size()[0], frame_size()[1])) \n"," # put output video name\n","for i in range(1, len(os.listdir('/content/output/'))):\n"," img = cv.imread(f'/content/output/frame{i}_mask.png') \n"," out.write(img)\n","out.release()\n","shutil.rmtree('/content/lama/data_image', ignore_errors=True) \n","shutil.rmtree('/content/output', ignore_errors=True)\n","print ('Video formation done')\n","\n","vname = None"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":1000},"id":"hkwxUeG7zUkg","outputId":"783a0707-4f7f-4080-9ad1-5e7e8905ad06","executionInfo":{"status":"ok","timestamp":1681744639635,"user_tz":-330,"elapsed":615526,"user":{"displayName":"Sri Om Subham (M22AI836)","userId":"00908540382614000284"}}},"execution_count":16,"outputs":[{"output_type":"stream","name":"stdout","text":["Will use /content/lama/frame1.png for inpainting\n"]},{"output_type":"display_data","data":{"text/plain":[""],"text/html":["\n","\n","\n","\n","\n","\n","\n","\n"]},"metadata":{}},{"output_type":"display_data","data":{"text/plain":["