TITLE: Protocol_mask_RCNN_CT_tensorflow
AUTHORS: Ching-Juei Yang, Jing-Yao Wang

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">This document outlines the implementation of mask-RCNN of computed tomography under tensorflow</div><div class = "text-block"><span>This testing protocol includes the public medical images from "The Cancer Imaging Archive" (TCIA)(</span><a href="https://www.cancerimagingarchive.net/)," style = "text-decoration:underline;color:blue;cursor:pointer;"><span style = ":;">https://www.cancerimagingarchive.net/),</span></a><span> Google Brain's Tensorflow (</span><a href="https://github.com/tensorflow)," style = "text-decoration:underline;color:blue;cursor:pointer;"><span style = ":;">https://github.com/tensorflow),</span></a><span> TensorBoard, pre-trained COCO dataset, OpenCV library under Python 3 and NVIDIA GPU.</span></div><div class = "text-block">@ Ching-Juei Mark Yang @ Jing-Yao Wang    May 9, 2021</div></div>

[STEPS]
?. Protocol testing datasets were acquired from the collection of "TCGA-LIHC" (https://wiki.cancerimagingarchive.net/display/Public/TCGA-LIHC) of the public medical images from TCIA.
?. "dcmtojpgpngITK-v3-subfolder.py" is designed for converting *.dcm to *.png under clinical desired window center and window level.
?. "LabelMe" under python 3 was used for region of interest (ROI) labeling
?. The folder of "./tfrecordjson/json_test" contains the *.png and corresponding *.json files for program testing
?. We used tensorflow-gpu 1.2 under python 3.6 version with NVIDIA GEFORCE RTX 2080 Ti
?. The details of setting environment was guided as followings mdfile under windows 10   "Environment setup.md"
?. 
?. 
?. The tfrecordjson folder contains files for tensorflow binary data transformation (https://www.tensorflow.org/tutorials/load_data/tfrecord)   referring to @author: QingShui-Cheng (TFrecord_json.py) and @author: shirhe-lyh (read_pbtxt_file.py)   execute   python TFrecord_json.py --images_dir=./json_test --label_map_path=./liver_lesion_map.pbtxt --output_path=./   produce sample_train.record and sample_val.record datsests
?. Download tensorflow/models (https://github.com/tensorflow/models)
?. the ./tfrecord/json_test   contains the *png and *.json
?. Download pipline.config (mask_rcnn_resnet101_atrous_coco.config) and coco-trained models from tensorflow model zoo (https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/tf1_detection_zoo.md)  eg. mask_rcnn_resnet101_atrous_coco.tar
?. building the folder of "liver_resnet"models-master - official              - research - liver_resnet - dataset - sample_train/val.record                                        - model                                          (model.ckpt.data-0000-of-0001                                           model.ckpt.index                                           model.ckpt.meta                                           pipline.config)                                        - trained_model                                        - *.pbtxt, pipline.config                                          (liver_lesion_map.pbtxt,                                    mask_rcnn_resnet101_atrous_coco.config )              - sample              - tutorials
?. 
?. Modifying and setting your pipline.config    1. Setting tf_record_input_reader with your local tfrecord path (include training and eval)    2. Setting label_map_path with your local label_map file path (include training and eval)    3. Setting your fine_tune_checkpoint path
?. execute the train process    at reaserch path    python ./object_detection/model_main.py --alsologtostderr --model_dir=./liver_resnet/trained_model --pipeline_config_path=./liver_resnet/mask_rcnn_resnet101_atrous_coco.config
?. execute the tensorboard    at research path    tensorboard --logdir=./liver_resnet/trained_model --port=####    (eg. tensorboard --logdir=./liver_resnet/trained_model --port=6006)    by guiding of tensorboard command line, please open chrome webBrowser and type  "https:://*name_of_computer:####"    record the optimal training steps to avoid overfitting
?. export the trained model from optimal.ckpt to *.pb    at research path    python object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path liver_resnet/mask_rcnn_resnet101_atrous_coco.config --trained_checkpoint_prefix liver_resnet/trained_model/model.ckpt-#### --output_directory liver_resnet/export_model/
?. Using inference_contour_LD.py, optimal_model.pb, and *.pbtxt(eg. liver_lesion_label_map.pbtxt) for detecting *.png
?. 
?. 
?. 
?.