From bddd7255fcf41db35901db11f239b826de8135a1 Mon Sep 17 00:00:00 2001 From: Fanrui Meng Date: Thu, 23 Jul 2020 08:32:12 -0400 Subject: [PATCH] Update readme.md --- 2020_Arabidopsis_seed_count/readme.md | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/2020_Arabidopsis_seed_count/readme.md b/2020_Arabidopsis_seed_count/readme.md index 8b13789..3ef7a47 100644 --- a/2020_Arabidopsis_seed_count/readme.md +++ b/2020_Arabidopsis_seed_count/readme.md @@ -1 +1,61 @@ +

Arabidopsis seeds count using Tensorflow Faster-RCNN model

+

1 Tensorflow object detection API installation

+ tensorflow version lower than 2.0. + please see: + https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md + +

2 Seed annotation

+ we use LabelImg annotate our seeds, LabelImg generate a xml annotation file.
+ LabelImg please see: https://github.com/tzutalin/labelImg
+ For our project, we split one whole plate image into 4 quater images and annotate quater images mannually.
+ a. split image:
+python 00_split_scan_images.py
+b. seed annotation + Seed annotation +

3 Xml file transform to csv file

+ pyhton 02_xml_to_csv.py
+ + Results is a csv file, like this:

+ + + + + +
filename width height class xminyminxmaxymax
scan21_111918022.jpg 2900 2900 seed 13258131352837
scan21_111918022.jpg 2900 2900 seed 66410946911116
.. .. .. .. ........
+

4. seed_labels.csv transform to tensorflow tfrecord file

+ + python 02_generate_tfrecord.py --csv_input=annotation/seeds_labels.csv --output_path=train.record + +

5 Download tensorflow object detection api pre-trained faster rcnn model to work directory.

+ wget http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_v2_coco_2018_01_28.tar.gz
+ unzip faster_rcnn_inception_v2_coco_2018_01_28.tar.gz + +

6 pipeline configuration +

a. input configuration

+ train_input_reader: {
+   tf_record_input_reader {
+     input_path: "train.record"
+   }
+ +   label_map_path: "mscoco_label_map.pb
+} +

b. The label_map.pbtxt file like below:

+ item {
+   id: 1
+   name: "seed"
+ }
+ c. Another configurations please see: + https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/configuring_jobs.md +

7 Model training

+ python3 03_train.py --logtostderr --pipeline_config_path=pipeline.config --train_dir=train_dir --num_clones=3 +

8 Generate frozen model

+ python3 05_export_inference_graph.py --input_type image_tensor --pipeline_config_path pipeline.config --trained_checkpoint_prefix train_dir/model.ckpt- --output_directory graph_train +

9 Detect seeds using trained model

+ python 06_detect.py +

10 Accuracy measurement

+Measure accuracy, precision, recall and f1 at IOU 0.5 using 07_01_accuracy_measurement.py
+python 07_01_accuracy_measurement.py ground.csv detected.csv +

11 seed density

+Average seed number in a circle with a radius of 30 pixels.
+Rscript seed_density.r