Showcases the use of deep learning to detect wheat heads from crops. The project is based on this Kaggle Competition: https://www.kaggle.com/c/global-wheat-detection.
Here's a description of the prediction task:
In this competition, youβll detect wheat heads from outdoor images of wheat plants, including wheat datasets from around the globe. Using worldwide data, you will focus on a generalized solution to estimate the number and size of wheat heads. To better gauge the performance for unseen genotypes, environments, and observational conditions, the training dataset covers multiple regions. You will use more than 3,000 images from Europe (France, UK, Switzerland) and North America (Canada). The test data includes about 1,000 images from Australia, Japan, and China.
An overview is available here: https://www.kaggle.com/c/global-wheat-detection/data.
The dataset includes images that either have wheat heads or do not have them. Here are some examples:
(The following ones do not have any wheat heads)
I used the following command to obtain the data:
$ kaggle competitions download -c global-wheat-detection
This is an object detection task and the project uses TensorFlow Object Detection (TFOD) API .
βββ faster_rcnn_resnet101_coco_11_06_2017: Contains the pre-trained checkpoints and frozen inference graph.
β βββ saved_model
β β βββ variables
β β βββ saved_model.pb
β βββ checkpoint
β βββ frozen_inference_graph.pb
β βββ model.ckpt.data-00000-of-00001
β βββ model.ckpt.index
β βββ model.ckpt.meta
β βββ pipeline.config
βββ test: Contains the test images of the competition.
β βββ 2fd875eaa.jpg
β βββ 348a992bb.jpg
β βββ 51b3e36ab.jpg
β βββ 51f1be19e.jpg
β βββ 53f253011.jpg
β βββ 796707dd7.jpg
β βββ aac893a91.jpg
β βββ cb8d261a3.jpg
β βββ cc3532ff6.jpg
β βββ f5a1f0358.jpg
βββ train: Contains the training images of the competition.
βββ Basic_EDA.ipynb: Performs basic data visualization on the provided dataset.
βββ Data_Prep.ipynb: Prepares the data in a TFOD API compatible format.
βββ faster_rcnn_resnet101_pets.config: Training configuration file.
βββ generate_tfrecord.py: Utility script for generating TFRecords from `.csv` files.
βββ label_map.pbtxt: Label map file.
βββ new_train_df.csv: The newly created partial training set.
βββ train.csv: Comes with the initial dataset & contain information about the bounding boxes.
βββ train_df.csv: Expanded version of the initial `train.csv` file.
βββ train.record: TFRecord file of the partial training set.
βββ valid_df.csv: The newly created validation set.
βββ valid.record: TFRecord file of the validation set.
βββ Wheat_Head_Detection_YoloV4.ipynb : The notebook for YoloV4 Setup and Prediction
Note
The files that you don't see here in the directory were not intentionally provided because of their sizes.
Following are the results I got from TensorBoard while my model was training (following are images from the validation set I prepared):
-
Follow the instructions from
Data_Prep.ipynb
notebook. -
Once the new training and validation splits are generated run
generate_tfrecord.py
script for generating the TFRecords. -
Download the pre-trained checkpoints of Faster RCNN with Inception Network as base by running:
wget http://download.tensorflow.org/models/object_detection/faster_rcnn_resnet101_coco_2018_01_28.tar.gz
-
Follow instructions from this piece on how to package an object detection application in TensorFlow Object Detection API and submit a training job to AI Platform. It also shows how to monitor performance with TensorBoard and export the trained model checkpoints as a frozen inference graph.
-
Run the Ipynb Notebook if you want to get the same results using YoloV4.
- Sayak Paul for Faster-RCNN Setup