Skip to content

Commit f5fa9c8

Browse files
Fix readme files and SR demo (openvinotoolkit#113)
* Some fixes in readme files * Add checkpoint ot ignore * Fix resize * File tree
1 parent b76925a commit f5fa9c8

File tree

6 files changed

+36
-27
lines changed

6 files changed

+36
-27
lines changed

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ data/*
1111
external/*
1212

1313
*egg-info
14+
15+
*.pth
16+
*.onnx
17+
*.xml
18+
*.bin

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ inference.
3232
* [Face recognition](pytorch_toolkit/face_recognition)
3333
* [Human pose estimation](pytorch_toolkit/human_pose_estimation)
3434
* [Instance segmentation](pytorch_toolkit/instance_segmentation)
35+
* [Object Detection](pytorch_toolkit/object_detection)
36+
- [Face Detection](pytorch_toolkit/object_detection/face_detection.md)
37+
- [Person Vehicle Bike Detector](pytorch_toolkit/object_detection/person_vehicle_bike_detection.md)
38+
* [Segmentation of thoracic organs](pytorch_toolkit/segthor)
3539
* [Super resolution](pytorch_toolkit/super_resolution)
3640

3741
* [TensorFlow](tensorflow_toolkit)

pytorch_toolkit/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ Do not forget to update several environment variables are required to compile an
4444
After installation, you are ready to train your own models, evaluate them, use
4545
them for predictions.
4646

47+
* [Action recognition](action_recognition)
4748
* [Face recognition](face_recognition)
4849
* [Human pose estimation](human_pose_estimation)
4950
* [Instance segmentation](instance_segmentation)
51+
* [Object Detection](object_detection)
52+
- [Face Detection](object_detection/face_detection.md)
53+
- [Person Vehicle Bike Detector](object_detection/person_vehicle_bike_detection.md)
54+
* [Segmentation of thoracic organs](segthor)
5055
* [Super resolution](super_resolution)

pytorch_toolkit/object_detection/face_detection.md

+19-24
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,27 @@ This repository contains training scripts for lightweight SSD-based face detecto
55

66
## Prerequisites
77

8-
1. Download mmdetection submodule:
9-
`git submodule update --init --recommend-shallow ../../external/mmdetection`
10-
2. Download the [WIDER Face](http://shuoyang1213.me/WIDERFACE/) and unpack it to `data` folder.
11-
3. Annotation in the VOC format can be found in this
8+
1. Download the [WIDER Face](http://shuoyang1213.me/WIDERFACE/) and unpack it to `data` folder.
9+
2. Annotation in the VOC format can be found in this
1210
[repo](https://github.com/sovrasov/wider-face-pascal-voc-annotations.git). Move the annotation files from
1311
`WIDER_train_annotations` and `WIDER_val_annotations` folders to the `Annotation` folders inside the corresponding
1412
directories `WIDER_train` and `WIDER_val`. Also annotation lists `val.txt` and `train.txt` should be copied to
1513
`data/WIDERFace` from `WIDER_train_annotations` and `WIDER_val_annotations`.
1614
The directory should be like this:
1715

1816
```
19-
object_detection
20-
├── tools
21-
├── data
22-
│ ├── WIDERFace
23-
│ │ ├── WIDER_train
24-
│ | │ ├──0--Parade
25-
│ | │ ├── ...
26-
│ | │ ├── Annotations
27-
│ │ ├── WIDER_val
28-
│ | │ ├──0--Parade
29-
│ | │ ├── ...
30-
│ | │ ├── Annotations
31-
│ │ ├── val.txt
32-
│ │ ├── train.txt
33-
17+
data
18+
└── WIDERFace
19+
├── WIDER_train
20+
│ ├──0--Parade
21+
│ ├── ...
22+
│ └── Annotations
23+
├── WIDER_val
24+
│ ├──0--Parade
25+
│ ├── ...
26+
│ └── Annotations
27+
├── val.txt
28+
└── train.txt
3429
```
3530

3631
## Training
@@ -40,7 +35,7 @@ object_detection
4035
2. To train the detector on a single GPU run in terminal:
4136
```bash
4237
python3 ../../external/mmdetection/tools/train.py \
43-
../../external/mmdetection/configs/wider_face/mobilenetv2_tiny_ssd300_wider_face.py
38+
configs/mobilenetv2_tiny_ssd300_wider_face.py
4439
```
4540

4641

@@ -58,7 +53,7 @@ object_detection
5853
```bash
5954
python3 ../../external/mmdetection/tools/voc_eval.py \
6055
result.pkl \
61-
../../external/mmdetection/configs/wider_face/mobilenetv2_tiny_ssd300_wider_face.py
56+
configs/mobilenetv2_tiny_ssd300_wider_face.py
6257
```
6358
One should observe 0.305 AP on validation set. For more detailed results and comparison with vanilla SSD300 see `../../external/mmdetection/configs/wider_face/README.md`.
6459

@@ -67,7 +62,7 @@ object_detection
6762
1. Convert PyTorch model to ONNX format: run script in terminal
6863
```bash
6964
python3 tools/onnx_export.py \
70-
../../external/mmdetection/configs/wider_face/mobilenetv2_tiny_ssd300_wider_face.py
65+
configs/mobilenetv2_tiny_ssd300_wider_face.py
7166
<CHECKPOINT> \
7267
face_detector.onnx
7368
```
@@ -89,7 +84,7 @@ object_detection
8984
To run the demo connect a webcam end execute command:
9085
```bash
9186
python3 tools/detection_live_demo.py \
92-
../../external/mmdetection/configs/wider_face/mobilenetv2_tiny_ssd300_wider_face.py \
87+
configs/mobilenetv2_tiny_ssd300_wider_face.py \
9388
<CHECKPOINT> \
9489
--cam_id 0
9590
```
@@ -109,5 +104,5 @@ python3 tools/count_flops.py configs/mobilenetv2_tiny_ssd300_wider_face.py
109104
described in this instruction.
110105
* Fine-tuning steps are the same as step 2 for training, but some adjustments in config are needed:
111106
- specify initial checkpoint containing a valid detector in `load_from` field of config
112-
`configsmobilenetv2_tiny_ssd300_wider_face.py`
107+
`configs/mobilenetv2_tiny_ssd300_wider_face.py`
113108
- edit `data` section of config to pass a custom dataset.

pytorch_toolkit/segthor/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ pip3 install -e .
104104

105105
```
106106
python tools/prepare_training_dataset.py \
107-
--input_path /home/localadmin/segthor/data/train \
108-
--output_path /home/localadmin/segthor/data/experimental \
107+
--input_path data/train \
108+
--output_path data/experimental \
109109
--new_scale 1 1 2.5
110110
```
111111

pytorch_toolkit/super_resolution/tools/infer_ie.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def main():
6969
if image.shape[0] != ih or image.shape[1] != iw:
7070
image = image[0:ih, 0:iw]
7171

72-
cubic = cv2.resize(image, tuple(inputs[1][1][2:]), interpolation=cv2.INTER_CUBIC)
72+
cubic = cv2.resize(image, (inputs[1][1][3], inputs[1][1][2]), interpolation=cv2.INTER_CUBIC)
7373

7474
blob1 = image_to_blob(image, (inputs[0][1]))
7575
blob2 = image_to_blob(cubic, (inputs[1][1]))

0 commit comments

Comments
 (0)