In the following code, we will train the Faster R-CNN algorithm to detect the bounding boxes around objects present in images. For this, we will work on the same truck versus bus detection exercise that we worked on in the previous chapter:
The following code is available as Training_Faster_RCNN.ipynb in the Chapter08 folder of this book's GitHub repository - https://tinyurl.com/mcvp-packt.
- Download the dataset:
import os
if not os.path.exists('images'):
!pip install -qU torch_snippets
from google.colab import files
files.upload() # upload kaggle.json
!mkdir -p ~/.kaggle
!mv kaggle.json ~/.kaggle/
!ls ~/.kaggle
!chmod 600 /root/.kaggle/kaggle.json
!kaggle datasets download \
-d sixhky/open-images-bus-trucks/
!unzip -qq open-images-bus-trucks.zip
!rm open-images-bus-trucks.zip
- Read the DataFrame containing metadata of information about images and their bounding box, and classes:
from torch_snippets...