Commit 5eaeb037 authored by Oksana Belyaeva's avatar Oksana Belyaeva
Browse files

rewrited README

parent 472614fd
# TensorFlow Object Detection API Tutorial
This repository has the code from my [O'Reilly article](https://www.oreilly.com/ideas/object-detection-with-tensorflow) published on October 25, 2017.
## Required Packages
* [TensorFlow v1.3](http://www.tensorflow.org/)
* [Jupyter](http://jupyter.org/)
* [NumPy](http://www.numpy.org/)
* [Scipy](https://www.scipy.org/)
* [Matplotlib](http://matplotlib.org/)
* [Scikit-Image](http://scikit-image.org/)
* [Pandas](http://pandas.pydata.org/)
* [lxml](http://lxml.de/)
* [protobuf](https://github.com/google/protobuf)
There are two ways you can install these packages: by using Docker or by using native Python 3.5.
### Using Native Python 3
1. Install system requirements
```bash
sudo apt-get install -y git-core wget protobuf-compiler
```
2. Download and unzip [this entire repo from GitHub](https://github.com/wagonhelm/TF_ObjectDetection_API), either interactively, or by entering
```bash
git clone https://github.com/wagonhelm/TF_ObjectDetection_API.git
```
3. Install Python Requirement
```bash
cd TF_ObjectDetection_API
# Requires sudo if not in a virtual environment
pip3 install -r requirements.txt
pip3 install tensorflow jupyter
```
4. Clone TensorFlow Models Into Repository Directory and Install Object Detection API
```bash
cd TF_ObjectDetection_API
git clone https://github.com/tensorflow/models.git
```
You will have to run this command every time you close your terminal unless you add the the path to slim to your `.bashrc` file
```bash
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
cd ..
cd ..
```
4. Launch Jupyter
```bash
jupyter notebook
```
5. Launch Tensorboard In New Terminal
```bash
tensorboard --logdir='data'
```
Once both jupyter and tensorboard are running, using your browser, navigate to the URLs shown in the terminal output if those don't work try http://localhost:8888/ for Jupyter Notebook and http://localhost:6006/ for Tensorboard.
### Work with TensorFlow Object Detection API and Google PubLayNet dataset
1 Структура датасета PubLayNet
```bash
Датасет размещен по https://dax-assets-dev.s3.us-south.cloud-object-storage.appdomain.cloud/dax-publaynet/1.0.0/PubLayNet.html
Датасет PubLayNet помещен в директорию DataSet/:
DataSet/jsons - скачанный json (train-<number>.json, test.json)
DataSet/csv - генерированные csv из json (train-<number>.csv, test.csv)
DataSet/images - скачанные изображения в подпапках ("train-<number>/", "test/", "examples/", "examples_res/"), где
PubLayNet/jsons - скачанный json (COCO-формат) (train-<number>.json, test.json)
PubLayNet/csv - генерированные csv из json (train-<number>.csv, test.csv)
PubLayNet/images - скачанные изображения в подпапках ("train-<number>/", "test/", "examples/", "examples_res/"), где
"examples/" - изображения для тестирования скаченные из https://github.com/ibm-aur-nlp/PubLayNet/tree/master/examples
"examples_res/" - результат тестирования
DataSet/labeled - изображения с нарисованным GT, генерируются из DataSet/draw_GT.py
PubLayNet/labeled - изображения с нарисованным GT, генерируются из DataSet/draw_GT.py
```
2 Конвертация json в csv
......@@ -101,11 +38,39 @@ python3 models/research/object_detection/legacy/train.py --logtostderr --train_d
```bash
rm -rf object_detection_graph
python3 models/research/object_detection/export_inference_graph.py --input_type image_tensor --pipeline_config_path configs/faster_rcnn_resnet101_coco.config --trained_checkpoint_prefix training/data_PubNet_frcnn/model.ckpt-<number_need_checkpoint> --output_directory object_detection_graph
```
6 Тестирование модели
6 Тестирование модели (predict)
```bash
python test_model.py
```
7 Тестирование модели на тестовом наборе и вычисление точности по coco-api
```bash
python evaluate_model.py
```
8 Преобразователи форматов GT в utils_convert_draw_format/
* convert_csv_to_coco.py - csv в COCO format
* convert_json_to_csv.py - COCO format в csv
* convert_pascal_to_csv.py - Pascal формат в csv
* draw_GT_coco.py - нарисовать GT COCO формата
9 Скрипты для создания tfrecords из изображений для тренинга и их GT расположены в папках датасетов PubLayNet и CLAWDATA:
* PubLayNet/generate_tfrecords_publaynet.py
* CLAWDATA/generate_tfrecords_claw_data.py
You will have to run this command every time you close your terminal unless you add the the path to slim to your `.bashrc` file
```bash
cd models/research/
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
cd ..
cd ..
```
7 Launch Tensorboard In New Terminal
```bash
tensorboard --logdir='data'
```
Once both jupyter and tensorboard are running, using your browser, navigate to the URLs shown in the terminal output if those don't work try http://localhost:8888/ for Jupyter Notebook and http://localhost:6006/ for Tensorboard.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment