Skip to content

Commit 1ace507

Browse files
committed
change to absolute coord
1 parent 88bfb31 commit 1ace507

14 files changed

+646
-700
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This repository contains codes of the reimplementation of [SSD: Single Shot Mult
44

55
There are already some TensorFlow based SSD reimplementation codes on GitHub, the main special features of this repo inlcude:
66

7-
- state of the art performance(77.8%mAP) when training from VGG-16 pre-trained model (SSD300-VGG16).
7+
- state of the art performance(77.4%mAP) when training from VGG-16 pre-trained model (SSD300-VGG16).
88
- the model is trained using TensorFlow high level API [tf.estimator](https://www.tensorflow.org/api_docs/python/tf/estimator/Estimator). Although TensorFlow provides many APIs, the Estimator API is highly recommended to yield scalable, high-performance models.
99
- all codes were writen by pure TensorFlow ops (no numpy operation) to ensure the performance and portability.
1010
- using ssd augmentation pipeline discribed in the original paper.
@@ -65,15 +65,15 @@ All the codes was tested under TensorFlow 1.6, Python 3.5, Ubuntu 16.04 with CUD
6565

6666
## Results (VOC07 Metric)
6767

68-
This implementation(SSD300-VGG16) yield **mAP 77.8%** on PASCAL VOC 2007 test dataset(the original performance described in the paper is 77.2%mAP), the details are as follows:
68+
This implementation(SSD300-VGG16) yield **mAP 77.4%** on PASCAL VOC 2007 test dataset(the original performance described in the paper is 77.2%mAP), the details are as follows:
6969

7070
| sofa | bird | pottedplant | bus | diningtable | cow | bottle | horse | aeroplane | motorbike
7171
|:-------|:-----:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|:-------:|
72-
| 79.6 | 76.0 | 52.8 | 85.9 | 76.9 | 83.5 | 49.9 | 86.0 | 82.9 | 81.0 |
72+
| 78.8 | 76.3 | 53.3 | 86.2 | 77.7 | 83.0 | 52.7 | 85.5 | 82.3 | 82.2 |
7373
| **sheep** | **train** | **boat** | **bicycle** | **chair** | **cat** | **tvmonitor** | **person** | **car** | **dog** |
74-
| 81.6 | 86.2 | 71.8 | 84.2 | 60.2 | 87.8 | 76.7 | 80.5 | 85.5 | 86.2 |
74+
| 77.2 | 87.3 | 69.7 | 83.3 | 59.0 | 88.2 | 74.6 | 79.6 | 84.8 | 85.1 |
7575

76-
You can download the trained model(VOC07+12 Train) from [GoogleDrive](https://drive.google.com/open?id=1yeYcfcOURcZ4DaElEn9C2xY1NymGzG5W) for further research.
76+
You can download the trained model(VOC07+12 Train) from [GoogleDrive](https://drive.google.com/open?id=1sr3khWzrXZtcS5mmkQDL00y07Rj7erW5) for further research.
7777

7878
For Chinese friends, you can also download both the trained model and pre-trained vgg16 weights from [BaiduYun Drive](https://pan.baidu.com/s/1kRhZd4p-N46JFpVkMgU3fg), access code: **tg64**.
7979

dataset/convert_tfrecords.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
| |->Annotations/
4444
| |->...
4545
'''
46-
tf.app.flags.DEFINE_string('dataset_directory', '/media/rs/7A0EE8880EE83EAF/Detections/PASCAL/VOC',
46+
tf.app.flags.DEFINE_string('dataset_directory', './dataset/VOC',
4747
'All datas directory')
4848
tf.app.flags.DEFINE_string('train_splits', 'VOC2007, VOC2012',
4949
'Comma-separated list of the training data sub-directory')
5050
tf.app.flags.DEFINE_string('validation_splits', 'VOC2007TEST',
5151
'Comma-separated list of the validation data sub-directory')
52-
tf.app.flags.DEFINE_string('output_directory', '/media/rs/7A0EE8880EE83EAF/Detections/SSD/dataset/tfrecords',
52+
tf.app.flags.DEFINE_string('output_directory', './dataset/tfrecords',
5353
'Output data directory')
5454
tf.app.flags.DEFINE_integer('train_shards', 16,
5555
'Number of shards in training TFRecord files.')
@@ -228,7 +228,7 @@ def _find_image_bounding_boxes(directory, cur_record):
228228
difficult = []
229229
truncated = []
230230
for obj in root.findall('object'):
231-
label = obj.find('name').text
231+
label = obj.find('name').text.strip()
232232
labels.append(int(dataset_common.VOC_LABELS[label][0]))
233233
labels_text.append(label.encode('ascii'))
234234

@@ -245,10 +245,10 @@ def _find_image_bounding_boxes(directory, cur_record):
245245
truncated.append(0)
246246

247247
bbox = obj.find('bndbox')
248-
bboxes.append((float(bbox.find('ymin').text) / shape[0],
249-
float(bbox.find('xmin').text) / shape[1],
250-
float(bbox.find('ymax').text) / shape[0],
251-
float(bbox.find('xmax').text) / shape[1]
248+
bboxes.append((float(bbox.find('ymin').text) - 1.,
249+
float(bbox.find('xmin').text) - 1.,
250+
float(bbox.find('ymax').text) - 1.,
251+
float(bbox.find('xmax').text) - 1.
252252
))
253253
return bboxes, labels, labels_text, difficult, truncated
254254

dataset/dataset_common.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,17 @@ def slim_get_batch(num_classes, batch_size, split_name, file_pattern, num_reader
221221
gbboxes_raw = tf.boolean_mask(gbboxes_raw, isdifficult_mask)
222222

223223
# Pre-processing image, labels and bboxes.
224-
224+
tensors_to_batch = []
225225
if is_training:
226226
image, glabels, gbboxes = image_preprocessing_fn(org_image, glabels_raw, gbboxes_raw)
227+
gt_targets, gt_labels, gt_scores = anchor_encoder(glabels, gbboxes)
228+
tensors_to_batch = [image, filename, shape, gt_targets, gt_labels, gt_scores]
227229
else:
228-
image = image_preprocessing_fn(org_image, glabels_raw, gbboxes_raw)
229-
glabels, gbboxes = glabels_raw, gbboxes_raw
230-
231-
gt_targets, gt_labels, gt_scores = anchor_encoder(glabels, gbboxes)
230+
image, output_shape = image_preprocessing_fn(org_image, glabels_raw, gbboxes_raw)
231+
tensors_to_batch = [image, filename, shape, output_shape]
232232

233-
return tf.train.batch([image, filename, shape, gt_targets, gt_labels, gt_scores],
234-
dynamic_pad=False,
233+
return tf.train.batch(tensors_to_batch,
234+
dynamic_pad=(not is_training),
235235
batch_size=batch_size,
236236
allow_smaller_final_batch=(not is_training),
237237
num_threads=num_preprocessing_threads,

dataset/dataset_inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ def count_split_examples(split_path, file_prefix='.tfrecord'):
3131
return num_samples
3232

3333
if __name__ == '__main__':
34-
print('train:', count_split_examples('/media/rs/7A0EE8880EE83EAF/Detections/SSD/dataset/tfrecords', 'train-?????-of-?????'))
35-
print('val:', count_split_examples('/media/rs/7A0EE8880EE83EAF/Detections/SSD/dataset/tfrecords', 'val-?????-of-?????'))
34+
print('train:', count_split_examples('./dataset/tfrecords', 'train-?????-of-?????'))
35+
print('val:', count_split_examples('./dataset/tfrecords', 'val-?????-of-?????'))

0 commit comments

Comments
 (0)