Merge pull request !7507 from zhanghuiyao/fix_retinafacetags/v1.1.0
| @@ -218,9 +218,9 @@ Parameters for both training and evaluation can be set in config.py | |||||
| ``` | ``` | ||||
| # grep "Val AP" eval.log | # 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, | OR, | ||||
| @@ -233,9 +233,9 @@ Parameters for both training and evaluation can be set in config.py | |||||
| ``` | ``` | ||||
| # grep "Val AP" eval.log | # 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 | | | Loss Function | MultiBoxLoss + Softmax Cross Entropy | | ||||
| | outputs | bounding box + confidence + landmark | | | outputs | bounding box + confidence + landmark | | ||||
| | Loss | 1.200 | | | 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 | | | Parameters (M) | 27.29M | | ||||
| | Checkpoint for Fine tuning | 336.3M (.ckpt file) | | | Checkpoint for Fine tuning | 336.3M (.ckpt file) | | ||||
| | Scripts | [retinaface script](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/retinaface) | | | Scripts | [retinaface script](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/retinaface) | | ||||
| @@ -179,7 +179,7 @@ class DetectionEngine: | |||||
| for event in self.results: | for event in self.results: | ||||
| for name in self.results[event].keys(): | for name in self.results[event].keys(): | ||||
| bbox = np.array(self.results[event][name]['bboxes']).astype(np.float) | bbox = np.array(self.results[event][name]['bboxes']).astype(np.float) | ||||
| if not bool(bbox): | |||||
| if bbox.shape[0] <= 0: | |||||
| continue | continue | ||||
| max_score = max(max_score, np.max(bbox[:, -1])) | max_score = max(max_score, np.max(bbox[:, -1])) | ||||
| min_score = min(min_score, np.min(bbox[:, -1])) | min_score = min(min_score, np.min(bbox[:, -1])) | ||||
| @@ -188,7 +188,7 @@ class DetectionEngine: | |||||
| for event in self.results: | for event in self.results: | ||||
| for name in self.results[event].keys(): | for name in self.results[event].keys(): | ||||
| bbox = np.array(self.results[event][name]['bboxes']).astype(np.float) | bbox = np.array(self.results[event][name]['bboxes']).astype(np.float) | ||||
| if not bool(bbox): | |||||
| if bbox.shape[0] <= 0: | |||||
| continue | continue | ||||
| bbox[:, -1] -= min_score | bbox[:, -1] -= min_score | ||||
| bbox[:, -1] /= length | bbox[:, -1] /= length | ||||
| @@ -227,7 +227,7 @@ class DetectionEngine: | |||||
| for section in range(section_num): | for section in range(section_num): | ||||
| _thresh = 1 - (section + 1)/section_num | _thresh = 1 - (section + 1)/section_num | ||||
| over_score_index = np.where(predict[:, 4] >= _thresh)[0] | 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, 0] = 0 | ||||
| image_pr[section, 1] = 0 | image_pr[section, 1] = 0 | ||||
| else: | else: | ||||
| @@ -264,10 +264,10 @@ class DetectionEngine: | |||||
| keep_index = event_gt_index_list[j][0] | keep_index = event_gt_index_list[j][0] | ||||
| count_gt += len(keep_index) | 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 | continue | ||||
| keep = np.zeros(gt_boxes.shape[0]) | keep = np.zeros(gt_boxes.shape[0]) | ||||
| if bool(keep_index): | |||||
| if keep_index.shape[0] > 0: | |||||
| keep[keep_index-1] = 1 | keep[keep_index-1] = 1 | ||||
| image_pr = self._image_eval(predict, gt_boxes, keep, | image_pr = self._image_eval(predict, gt_boxes, keep, | ||||
| @@ -55,7 +55,7 @@ def _choose_candidate(max_trial, image_w, image_h, boxes): | |||||
| dx = int(_rand(0, image_w - nw)) | dx = int(_rand(0, image_w - nw)) | ||||
| dy = int(_rand(0, image_h - nh)) | 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)) | crop_box = np.array((dx, dy, dx + nw, dy + nh)) | ||||
| if not _is_iof_satisfied_constraint(boxes, crop_box[np.newaxis]): | if not _is_iof_satisfied_constraint(boxes, crop_box[np.newaxis]): | ||||
| continue | continue | ||||
| @@ -71,7 +71,7 @@ def read_dataset(img_path, annotation): | |||||
| labels = annotation | labels = annotation | ||||
| anns = np.zeros((0, 15)) | anns = np.zeros((0, 15)) | ||||
| if not bool(labels): | |||||
| if labels.shape[0] <= 0: | |||||
| return anns | return anns | ||||
| for _, label in enumerate(labels): | for _, label in enumerate(labels): | ||||
| ann = np.zeros((1, 15)) | ann = np.zeros((1, 15)) | ||||