-
In custom.py updated class name to table(If not already edited).
-
Also replace images and annotation json in customeimages/ train and val folders!
-
Add the following into the code cell and execute.
!rm mask-rcnn-training/
!git clone https://github.com/Gerald2077/mask-rcnn-training
!pip install mrcnn
%cd mask-rcnn-training/
-
Clear the previous repo folder
!rm mask-rcnn-training/
-
Clone the repo,
!git clone https://github.com/Gerald2077/mask-rcnn-training
-
Install mask rcnn using pip
!pip install mrcnn
-
Navigate to the main directory
%cd mask-rcnn-training/
Don't need this now,
import sys
sys.path.insert(0, '/mask-rcnn-training')
-
Open inspect_custom_data.ipynb in google colab by providing github repo link.
-
Select GPU from Edit -> Notebook Settings
-
Do copy to drive action.
- Run this in a separate code block after making sure GPU is enabled in EDIT->Notebook Settings & you have the initial steps like deleting folder, cloning repo & making sure a couple of images from the dataset are viewable with mask, before proceeding with training(taking 50 mins at the moment on GPU)
!python3 custom.py train --dataset=customImages/ --weights=coco
-
After training we will save the generated h5 file to our local machine & use it for inference using CPU. We can also verify the same with another notebook, where we need to upload the h5 file & update the filename in that notebook as well.
-
To download the h5 weights file, do the following-
Keep updating the same code block with below lines & repeat individually,
%cd ..
%cd logs/
%cd {into latest table, check the training log for h5 file name & folder it is enclosed in.}
#then run the below,
from google.colab import files
files.download('mask_rcnn_table_0010.h5')
- Mounting google drive
from google.colab import drive
drive.mount('/content/gdrive')
- Copy the file to google drive
%cp mask_rcnn_table_0010.h5 /content/gdrive/'My Drive'/