fix train fail problem and fix readme.

This commit is contained in:
zhanghuiyao 2020-10-20 16:16:30 +08:00
parent 4637744100
commit 97e3c7374a
4 changed files with 15 additions and 15 deletions

View File

@ -218,9 +218,9 @@ Parameters for both training and evaluation can be set in config.py
```
# grep "Val AP" eval.log
Easy Val AP : 0.9437
Medium Val AP : 0.9334
Hard Val AP : 0.8904
Easy Val AP : 0.9413
Medium Val AP : 0.9325
Hard Val AP : 0.8900
```
OR,
@ -233,9 +233,9 @@ Parameters for both training and evaluation can be set in config.py
```
# grep "Val AP" eval.log
Easy Val AP : 0.9437
Medium Val AP : 0.9334
Hard Val AP : 0.8904
Easy Val AP : 0.9413
Medium Val AP : 0.9325
Hard Val AP : 0.8900
```
@ -258,8 +258,8 @@ Parameters for both training and evaluation can be set in config.py
| Loss Function | MultiBoxLoss + Softmax Cross Entropy |
| outputs | bounding box + confidence + landmark |
| Loss | 1.200 |
| Speed | 3pcs: 550 ms/step |
| Total time | 3pcs: 8.2 hours |
| Speed | 3pcs: 566 ms/step |
| Total time | 3pcs: 8.43 hours |
| Parameters (M) | 27.29M |
| Checkpoint for Fine tuning | 336.3M (.ckpt file) |
| Scripts | [retinaface script](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/retinaface) |

View File

@ -179,7 +179,7 @@ class DetectionEngine:
for event in self.results:
for name in self.results[event].keys():
bbox = np.array(self.results[event][name]['bboxes']).astype(np.float)
if not bool(bbox):
if bbox.shape[0] <= 0:
continue
max_score = max(max_score, np.max(bbox[:, -1]))
min_score = min(min_score, np.min(bbox[:, -1]))
@ -188,7 +188,7 @@ class DetectionEngine:
for event in self.results:
for name in self.results[event].keys():
bbox = np.array(self.results[event][name]['bboxes']).astype(np.float)
if not bool(bbox):
if bbox.shape[0] <= 0:
continue
bbox[:, -1] -= min_score
bbox[:, -1] /= length
@ -227,7 +227,7 @@ class DetectionEngine:
for section in range(section_num):
_thresh = 1 - (section + 1)/section_num
over_score_index = np.where(predict[:, 4] >= _thresh)[0]
if not bool(over_score_index):
if over_score_index.shape[0] <= 0:
image_pr[section, 0] = 0
image_pr[section, 1] = 0
else:
@ -264,10 +264,10 @@ class DetectionEngine:
keep_index = event_gt_index_list[j][0]
count_gt += len(keep_index)
if not bool(gt_boxes) or not bool(predict):
if gt_boxes.shape[0] <= 0 or predict.shape[0] <= 0:
continue
keep = np.zeros(gt_boxes.shape[0])
if bool(keep_index):
if keep_index.shape[0] > 0:
keep[keep_index-1] = 1
image_pr = self._image_eval(predict, gt_boxes, keep,

View File

@ -55,7 +55,7 @@ def _choose_candidate(max_trial, image_w, image_h, boxes):
dx = int(_rand(0, image_w - nw))
dy = int(_rand(0, image_h - nh))
if bool(boxes):
if boxes.shape[0] > 0:
crop_box = np.array((dx, dy, dx + nw, dy + nh))
if not _is_iof_satisfied_constraint(boxes, crop_box[np.newaxis]):
continue

View File

@ -71,7 +71,7 @@ def read_dataset(img_path, annotation):
labels = annotation
anns = np.zeros((0, 15))
if not bool(labels):
if labels.shape[0] <= 0:
return anns
for _, label in enumerate(labels):
ann = np.zeros((1, 15))