Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Training the multiclass segmentation NN

Vikram Tholakapalli edited this page Oct 1, 2020 · 1 revision

Train with google colab:

  • Convert images to npy (Skip if already using npy files) Use: ConvertImages.ipynb located in Shared Drives > RoboNav > Previous Year Resources > 2019-2020 Season > Software > Collab Notebooks > ConvertImages.ipynb

    1. Upload your images and masks to your google drive (Get masks and images from http://cloud.robojackets.org)
    2. Get the google drive path to the folder containing your images and masks
    3. Replace: images_path and masks_path with the folders containing your images and masks
    4. The resulting npy files will be placed in the same drive location
  • Use the UNetWithEfficientNet.ipynb located in Shared Drives > RoboNav > Previous Year Resources > 2019-2020 Season > Software > Collab Notebooks > UNetWithEfficientNet.ipynb

    1. Replace the train_images, train_masks, test_images, and test_masks with the npy files you want to train the neural net on
    2. Click run all

Train locally:

  1. Use python3.7 and download the dependencies in requirements.txt manually or using pip install -r requirements.txt.
  2. Obtain a dataset containing the images (PNGs) and masks (JSONs). Skip steps #2 and #3 if using .npy files.
  3. Run python make_dataset.py -images /path_to_images(png) -masks /path_to_masks(json)to generate .npy files. Example: python make_dataset.py -images 'annotations/**/*.png' -masks 'annotations/**/*.json'
  4. Establish train_images.npy, train_masks.npy, test_images.npy, and test_masks.npy files with python split_data.py -images '/path_to_images.npy' -masks '/path_to_masks.npy'
  5. Run python train.py -train_images '/path_to_train_images' -train_masks '/path_to_train_masks' -test_images '/path_to_test_images' -test_masks '/path_to_test_masks' to train and test the neural network.