diff --git a/model_zoo/official/cv/crnn/postprocess.py b/model_zoo/official/cv/crnn/postprocess.py index f321d70f3b..88eaba1542 100644 --- a/model_zoo/official/cv/crnn/postprocess.py +++ b/model_zoo/official/cv/crnn/postprocess.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -37,7 +37,7 @@ def read_annotation(ann_file): return ann -def read_IC13_annotation(ann_file): +def read_ic13_annotation(ann_file): file = open(ann_file) ann = {} @@ -60,14 +60,17 @@ def read_svt_annotation(ann_file): return ann def get_eval_result(result_path, ann_file): + """ + Calculate accuracy according to the annotation file and result file. + """ metrics = CRNNAccuracy(config) if args.dataset == "ic03" or args.dataset == "iiit5k": - ann = read_annotation(args.ann_file) + ann = read_annotation(ann_file) elif args.dataset == "ic13": - ann = read_IC13_annotation(args.ann_file) + ann = read_ic13_annotation(ann_file) elif args.dataset == "svt": - ann = read_svt_annotation(args.ann_file) + ann = read_svt_annotation(ann_file) for img_name, label in ann.items(): result_file = os.path.join(result_path, img_name[:-4] + "_0.bin") diff --git a/model_zoo/official/cv/ctpn/eval.py b/model_zoo/official/cv/ctpn/eval.py index ddb8509252..9fcb2c557c 100644 --- a/model_zoo/official/cv/ctpn/eval.py +++ b/model_zoo/official/cv/ctpn/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/ctpn/train.py b/model_zoo/official/cv/ctpn/train.py index eb2bc57539..ab21edd72d 100644 --- a/model_zoo/official/cv/ctpn/train.py +++ b/model_zoo/official/cv/ctpn/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/deeptext/eval.py b/model_zoo/official/cv/deeptext/eval.py index 280782ef48..a0fc73b3a8 100644 --- a/model_zoo/official/cv/deeptext/eval.py +++ b/model_zoo/official/cv/deeptext/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -43,7 +43,7 @@ args_opt = parser.parse_args() context.set_context(mode=context.GRAPH_MODE, device_target="Ascend", device_id=args_opt.device_id) -def Deeptext_eval_test(dataset_path='', ckpt_path=''): +def deeptext_eval_test(dataset_path='', ckpt_path=''): """Deeptext evaluation.""" ds = create_deeptext_dataset(dataset_path, batch_size=config.test_batch_size, repeat_num=1, is_training=False) @@ -114,9 +114,9 @@ def Deeptext_eval_test(dataset_path='', ckpt_path=''): print("\n========================================\n") for i in range(config.num_classes - 1): j = i + 1 - F1 = (2 * precisions[j] * recalls[j]) / (precisions[j] + recalls[j] + 1e-6) + f1 = (2 * precisions[j] * recalls[j]) / (precisions[j] + recalls[j] + 1e-6) print("class {} precision is {:.2f}%, recall is {:.2f}%," - "F1 is {:.2f}%".format(j, precisions[j] * 100, recalls[j] * 100, F1 * 100)) + "F1 is {:.2f}%".format(j, precisions[j] * 100, recalls[j] * 100, f1 * 100)) if config.use_ambigous_sample: break @@ -137,4 +137,4 @@ if __name__ == '__main__': print("CHECKING MINDRECORD FILES DONE!") print("Start Eval!") - Deeptext_eval_test(mindrecord_file, args_opt.checkpoint_path) + deeptext_eval_test(mindrecord_file, args_opt.checkpoint_path) diff --git a/model_zoo/official/cv/deeptext/src/Deeptext/vgg16.py b/model_zoo/official/cv/deeptext/src/Deeptext/vgg16.py index 43552e7b4d..c379843ca3 100644 --- a/model_zoo/official/cv/deeptext/src/Deeptext/vgg16.py +++ b/model_zoo/official/cv/deeptext/src/Deeptext/vgg16.py @@ -6,19 +6,19 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ + +"""VGG16 for deeptext""" + import mindspore.common.dtype as mstype import mindspore.nn as nn from mindspore.ops import operations as P -# """VGG16 for deeptext""" - - def _conv(in_channels, out_channels, kernel_size=3, stride=1, padding=0, pad_mode='pad'): """Conv2D wrapper.""" # shape = (out_channels, in_channels, kernel_size, kernel_size) @@ -60,6 +60,7 @@ class VGG16FeatureExtraction(nn.Cell): self.cast = P.Cast() def construct(self, x): + """ Construction of VGG """ x = self.cast(x, mstype.float32) x = self.conv1_1(x) x = self.relu(x) diff --git a/model_zoo/official/cv/deeptext/train.py b/model_zoo/official/cv/deeptext/train.py index 4e477c27d6..3a9fb49f1c 100644 --- a/model_zoo/official/cv/deeptext/train.py +++ b/model_zoo/official/cv/deeptext/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/faster_rcnn/eval.py b/model_zoo/official/cv/faster_rcnn/eval.py index eff5ea3bb0..0316a82d58 100644 --- a/model_zoo/official/cv/faster_rcnn/eval.py +++ b/model_zoo/official/cv/faster_rcnn/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -41,7 +41,7 @@ args_opt = parser.parse_args() context.set_context(mode=context.GRAPH_MODE, device_target=args_opt.device_target, device_id=args_opt.device_id) -def FasterRcnn_eval(dataset_path, ckpt_path, ann_file): +def fasterrcnn_eval(dataset_path, ckpt_path, ann_file): """FasterRcnn evaluation.""" ds = create_fasterrcnn_dataset(dataset_path, batch_size=config.test_batch_size, is_training=False) net = Faster_Rcnn_Resnet50(config) @@ -132,4 +132,4 @@ if __name__ == '__main__': print("CHECKING MINDRECORD FILES DONE!") print("Start Eval!") - FasterRcnn_eval(mindrecord_file, args_opt.checkpoint_path, args_opt.ann_file) + fasterrcnn_eval(mindrecord_file, args_opt.checkpoint_path, args_opt.ann_file) diff --git a/model_zoo/official/cv/faster_rcnn/postprocess.py b/model_zoo/official/cv/faster_rcnn/postprocess.py index f2b2a35743..89bfda3885 100644 --- a/model_zoo/official/cv/faster_rcnn/postprocess.py +++ b/model_zoo/official/cv/faster_rcnn/postprocess.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -28,7 +28,8 @@ parser.add_argument("--ann_file", type=str, required=True, help="ann file.") parser.add_argument("--img_path", type=str, required=True, help="image file path.") args = parser.parse_args() -def get_eval_result(ann_file, img_path): +def get_eval_result(ann_file): + """ get evaluation result of faster rcnn""" max_num = 128 result_path = "./result_Files/" @@ -69,4 +70,4 @@ def get_eval_result(ann_file, img_path): coco_eval(result_files, eval_types, dataset_coco, single_result=False) if __name__ == '__main__': - get_eval_result(args.ann_file, args.img_path) + get_eval_result(args.ann_file) diff --git a/model_zoo/official/cv/faster_rcnn/train.py b/model_zoo/official/cv/faster_rcnn/train.py index 1499407ff2..5ecba7eb1d 100644 --- a/model_zoo/official/cv/faster_rcnn/train.py +++ b/model_zoo/official/cv/faster_rcnn/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/maskrcnn/eval.py b/model_zoo/official/cv/maskrcnn/eval.py index db86130719..9044227597 100644 --- a/model_zoo/official/cv/maskrcnn/eval.py +++ b/model_zoo/official/cv/maskrcnn/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -39,7 +39,7 @@ args_opt = parser.parse_args() context.set_context(mode=context.GRAPH_MODE, device_target="Ascend", device_id=args_opt.device_id) -def MaskRcnn_eval(dataset_path, ckpt_path, ann_file): +def maskrcnn_eval(dataset_path, ckpt_path, ann_file): """MaskRcnn evaluation.""" ds = create_maskrcnn_dataset(dataset_path, batch_size=config.test_batch_size, is_training=False) @@ -129,4 +129,4 @@ if __name__ == '__main__': print("IMAGE_DIR or ANNO_PATH not exits.") print("Start Eval!") - MaskRcnn_eval(mindrecord_file, args_opt.checkpoint_path, args_opt.ann_file) + maskrcnn_eval(mindrecord_file, args_opt.checkpoint_path, args_opt.ann_file) diff --git a/model_zoo/official/cv/maskrcnn/postprocess.py b/model_zoo/official/cv/maskrcnn/postprocess.py index aac24138a9..1d49b36abf 100644 --- a/model_zoo/official/cv/maskrcnn/postprocess.py +++ b/model_zoo/official/cv/maskrcnn/postprocess.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -29,11 +29,11 @@ parser.add_argument("--ann_file", type=str, required=True, help="ann file.") parser.add_argument("--img_path", type=str, required=True, help="image file path.") args = parser.parse_args() -def get_imgSize(file_name): +def get_img_size(file_name): img = Image.open(file_name) return img.size -def get_resizeRatio(img_size): +def get_resize_ratio(img_size): org_width, org_height = img_size resize_ratio = dst_width / org_width if resize_ratio > dst_height / org_height: @@ -42,6 +42,7 @@ def get_resizeRatio(img_size): return resize_ratio def get_eval_result(ann_file, img_path): + """ Get metrics result according to the annotation file and result file""" max_num = 128 result_path = "./result_Files/" outputs = [] @@ -52,8 +53,8 @@ def get_eval_result(ann_file, img_path): for img_id in img_ids: file_id = str(img_id).zfill(12) file = img_path + "/" + file_id + ".jpg" - img_size = get_imgSize(file) - resize_ratio = get_resizeRatio(img_size) + img_size = get_img_size(file) + resize_ratio = get_resize_ratio(img_size) img_metas = np.array([img_size[1], img_size[0]] + [resize_ratio, resize_ratio]) diff --git a/model_zoo/official/cv/maskrcnn/train.py b/model_zoo/official/cv/maskrcnn/train.py index 941c881ffd..6f749f5564 100644 --- a/model_zoo/official/cv/maskrcnn/train.py +++ b/model_zoo/official/cv/maskrcnn/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/maskrcnn_mobilenetv1/eval.py b/model_zoo/official/cv/maskrcnn_mobilenetv1/eval.py index 3231399b31..04d2d7642c 100644 --- a/model_zoo/official/cv/maskrcnn_mobilenetv1/eval.py +++ b/model_zoo/official/cv/maskrcnn_mobilenetv1/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -39,7 +39,7 @@ args_opt = parser.parse_args() context.set_context(mode=context.GRAPH_MODE, device_target="Ascend", device_id=args_opt.device_id) -def MaskRcnn_eval(dataset_path, ckpt_path, ann_file): +def maskrcnn_eval(dataset_path, ckpt_path, ann_file): """MaskRcnn evaluation.""" ds = create_maskrcnn_dataset(dataset_path, batch_size=config.test_batch_size, is_training=False) @@ -131,4 +131,4 @@ if __name__ == '__main__': print("IMAGE_DIR or ANNO_PATH not exits.") print("Start Eval!") - MaskRcnn_eval(mindrecord_file, args_opt.checkpoint_path, args_opt.ann_file) + maskrcnn_eval(mindrecord_file, args_opt.checkpoint_path, args_opt.ann_file) diff --git a/model_zoo/official/cv/maskrcnn_mobilenetv1/train.py b/model_zoo/official/cv/maskrcnn_mobilenetv1/train.py index e181566883..573059c13d 100644 --- a/model_zoo/official/cv/maskrcnn_mobilenetv1/train.py +++ b/model_zoo/official/cv/maskrcnn_mobilenetv1/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/eval.py b/model_zoo/official/cv/retinaface_resnet50/eval.py index 5776967737..13106aa5bd 100644 --- a/model_zoo/official/cv/retinaface_resnet50/eval.py +++ b/model_zoo/official/cv/retinaface_resnet50/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -95,8 +95,8 @@ class DetectionEngine: intersect_area = intersect_w * intersect_h ovr = intersect_area / (areas[i] + areas[order[1:]] - intersect_area) - indexs = np.where(ovr <= threshold)[0] - order = order[indexs + 1] + indices = np.where(ovr <= threshold)[0] + order = order[indices + 1] return reserved_boxes diff --git a/model_zoo/official/cv/retinaface_resnet50/scripts/run_distribute_gpu_train.sh b/model_zoo/official/cv/retinaface_resnet50/scripts/run_distribute_gpu_train.sh index fd8f9cfd6f..4d0c6351f2 100644 --- a/model_zoo/official/cv/retinaface_resnet50/scripts/run_distribute_gpu_train.sh +++ b/model_zoo/official/cv/retinaface_resnet50/scripts/run_distribute_gpu_train.sh @@ -7,7 +7,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/scripts/run_standalone_gpu_eval.sh b/model_zoo/official/cv/retinaface_resnet50/scripts/run_standalone_gpu_eval.sh index 393f445c12..16f8911087 100644 --- a/model_zoo/official/cv/retinaface_resnet50/scripts/run_standalone_gpu_eval.sh +++ b/model_zoo/official/cv/retinaface_resnet50/scripts/run_standalone_gpu_eval.sh @@ -7,7 +7,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/src/augmemtation.py b/model_zoo/official/cv/retinaface_resnet50/src/augmemtation.py index 775c5f094d..7811fadceb 100644 --- a/model_zoo/official/cv/retinaface_resnet50/src/augmemtation.py +++ b/model_zoo/official/cv/retinaface_resnet50/src/augmemtation.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -170,7 +170,7 @@ def get_interp_method(interp, sizes=()): Neighbors method. (used by default). 4: Lanczos interpolation over 8x8 pixel neighborhood. 9: Cubic for enlarge, area for shrink, bilinear for others - 10: Random select from interpolation method metioned above. + 10: Random select from interpolation method mentioned above. Note: When shrinking an image, it will generally look best with AREA-based interpolation, whereas, when enlarging an image, it will generally look best diff --git a/model_zoo/official/cv/retinaface_resnet50/src/config.py b/model_zoo/official/cv/retinaface_resnet50/src/config.py index f66e054f42..98cba5beba 100644 --- a/model_zoo/official/cv/retinaface_resnet50/src/config.py +++ b/model_zoo/official/cv/retinaface_resnet50/src/config.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/src/dataset.py b/model_zoo/official/cv/retinaface_resnet50/src/dataset.py index b786d97384..a6d83bb792 100644 --- a/model_zoo/official/cv/retinaface_resnet50/src/dataset.py +++ b/model_zoo/official/cv/retinaface_resnet50/src/dataset.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/src/loss.py b/model_zoo/official/cv/retinaface_resnet50/src/loss.py index 19562b89b5..4caf1da277 100644 --- a/model_zoo/official/cv/retinaface_resnet50/src/loss.py +++ b/model_zoo/official/cv/retinaface_resnet50/src/loss.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/src/lr_schedule.py b/model_zoo/official/cv/retinaface_resnet50/src/lr_schedule.py index 3de5becbb5..e66b64c090 100644 --- a/model_zoo/official/cv/retinaface_resnet50/src/lr_schedule.py +++ b/model_zoo/official/cv/retinaface_resnet50/src/lr_schedule.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/src/network.py b/model_zoo/official/cv/retinaface_resnet50/src/network.py index 429739fd55..337a4e9aca 100644 --- a/model_zoo/official/cv/retinaface_resnet50/src/network.py +++ b/model_zoo/official/cv/retinaface_resnet50/src/network.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/src/utils.py b/model_zoo/official/cv/retinaface_resnet50/src/utils.py index 197608b50d..e31aec067d 100644 --- a/model_zoo/official/cv/retinaface_resnet50/src/utils.py +++ b/model_zoo/official/cv/retinaface_resnet50/src/utils.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinaface_resnet50/train.py b/model_zoo/official/cv/retinaface_resnet50/train.py index 0b1f0b93bb..550d8cbb72 100644 --- a/model_zoo/official/cv/retinaface_resnet50/train.py +++ b/model_zoo/official/cv/retinaface_resnet50/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinanet/eval.py b/model_zoo/official/cv/retinanet/eval.py index 88b984dbd2..1c432b857e 100644 --- a/model_zoo/official/cv/retinanet/eval.py +++ b/model_zoo/official/cv/retinanet/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/retinanet/train.py b/model_zoo/official/cv/retinanet/train.py index a34728081f..33a8828ab8 100644 --- a/model_zoo/official/cv/retinanet/train.py +++ b/model_zoo/official/cv/retinanet/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/ssd/eval.py b/model_zoo/official/cv/ssd/eval.py index 7a5c0e3167..459162f173 100644 --- a/model_zoo/official/cv/ssd/eval.py +++ b/model_zoo/official/cv/ssd/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/ssd/postprocess.py b/model_zoo/official/cv/ssd/postprocess.py index aac0dda813..3e0212ede9 100644 --- a/model_zoo/official/cv/ssd/postprocess.py +++ b/model_zoo/official/cv/ssd/postprocess.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/ssd/train.py b/model_zoo/official/cv/ssd/train.py index f39d2aa1b8..fbeee76244 100644 --- a/model_zoo/official/cv/ssd/train.py +++ b/model_zoo/official/cv/ssd/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/eval.py b/model_zoo/official/cv/unet/eval.py index f3a2cce6f4..a0919fd562 100644 --- a/model_zoo/official/cv/unet/eval.py +++ b/model_zoo/official/cv/unet/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/export.py b/model_zoo/official/cv/unet/export.py index 17eb773f40..b2ab03b110 100644 --- a/model_zoo/official/cv/unet/export.py +++ b/model_zoo/official/cv/unet/export.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/scripts/run_distribute_train.sh b/model_zoo/official/cv/unet/scripts/run_distribute_train.sh index f00014d27f..5d1555d9e9 100644 --- a/model_zoo/official/cv/unet/scripts/run_distribute_train.sh +++ b/model_zoo/official/cv/unet/scripts/run_distribute_train.sh @@ -7,7 +7,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/scripts/run_standalone_eval.sh b/model_zoo/official/cv/unet/scripts/run_standalone_eval.sh index ded1f908a0..2965138236 100644 --- a/model_zoo/official/cv/unet/scripts/run_standalone_eval.sh +++ b/model_zoo/official/cv/unet/scripts/run_standalone_eval.sh @@ -7,7 +7,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/scripts/run_standalone_train.sh b/model_zoo/official/cv/unet/scripts/run_standalone_train.sh index c8089b5a2b..c5f24633bc 100644 --- a/model_zoo/official/cv/unet/scripts/run_standalone_train.sh +++ b/model_zoo/official/cv/unet/scripts/run_standalone_train.sh @@ -7,7 +7,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/config.py b/model_zoo/official/cv/unet/src/config.py index 2e34a7bd6e..9d7578a5c2 100644 --- a/model_zoo/official/cv/unet/src/config.py +++ b/model_zoo/official/cv/unet/src/config.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/data_loader.py b/model_zoo/official/cv/unet/src/data_loader.py index 32f056628e..855007536d 100644 --- a/model_zoo/official/cv/unet/src/data_loader.py +++ b/model_zoo/official/cv/unet/src/data_loader.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/loss.py b/model_zoo/official/cv/unet/src/loss.py index 26793bd873..1561e7e184 100644 --- a/model_zoo/official/cv/unet/src/loss.py +++ b/model_zoo/official/cv/unet/src/loss.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/unet_medical/__init__.py b/model_zoo/official/cv/unet/src/unet_medical/__init__.py index da537aac8b..515a532a34 100644 --- a/model_zoo/official/cv/unet/src/unet_medical/__init__.py +++ b/model_zoo/official/cv/unet/src/unet_medical/__init__.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/unet_medical/unet_model.py b/model_zoo/official/cv/unet/src/unet_medical/unet_model.py index 26d5f271c6..91e884aab4 100644 --- a/model_zoo/official/cv/unet/src/unet_medical/unet_model.py +++ b/model_zoo/official/cv/unet/src/unet_medical/unet_model.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/unet_medical/unet_parts.py b/model_zoo/official/cv/unet/src/unet_medical/unet_parts.py index fe002dd5b6..b363b7f750 100644 --- a/model_zoo/official/cv/unet/src/unet_medical/unet_parts.py +++ b/model_zoo/official/cv/unet/src/unet_medical/unet_parts.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/unet_nested/__init__.py b/model_zoo/official/cv/unet/src/unet_nested/__init__.py index 6a392415be..d2343ab25a 100644 --- a/model_zoo/official/cv/unet/src/unet_nested/__init__.py +++ b/model_zoo/official/cv/unet/src/unet_nested/__init__.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/unet_nested/unet_model.py b/model_zoo/official/cv/unet/src/unet_nested/unet_model.py index bbfba469db..ce7c744a47 100644 --- a/model_zoo/official/cv/unet/src/unet_nested/unet_model.py +++ b/model_zoo/official/cv/unet/src/unet_nested/unet_model.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/unet_nested/unet_parts.py b/model_zoo/official/cv/unet/src/unet_nested/unet_parts.py index 8c072a24b8..a69acbba5d 100644 --- a/model_zoo/official/cv/unet/src/unet_nested/unet_parts.py +++ b/model_zoo/official/cv/unet/src/unet_nested/unet_parts.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/src/utils.py b/model_zoo/official/cv/unet/src/utils.py index d6bb9d653b..e141e25b91 100644 --- a/model_zoo/official/cv/unet/src/utils.py +++ b/model_zoo/official/cv/unet/src/utils.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/unet/train.py b/model_zoo/official/cv/unet/train.py index 37615f7003..f9939c8393 100644 --- a/model_zoo/official/cv/unet/train.py +++ b/model_zoo/official/cv/unet/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/yolov3_resnet18/eval.py b/model_zoo/official/cv/yolov3_resnet18/eval.py index f0b069f8a2..1cdddf51c7 100644 --- a/model_zoo/official/cv/yolov3_resnet18/eval.py +++ b/model_zoo/official/cv/yolov3_resnet18/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/official/cv/yolov3_resnet18/train.py b/model_zoo/official/cv/yolov3_resnet18/train.py index 30117671e1..b590aac08a 100644 --- a/model_zoo/official/cv/yolov3_resnet18/train.py +++ b/model_zoo/official/cv/yolov3_resnet18/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/research/cv/ssd_ghostnet/eval.py b/model_zoo/research/cv/ssd_ghostnet/eval.py index 98093bfec7..4a44fad825 100644 --- a/model_zoo/research/cv/ssd_ghostnet/eval.py +++ b/model_zoo/research/cv/ssd_ghostnet/eval.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/model_zoo/research/cv/ssd_ghostnet/train.py b/model_zoo/research/cv/ssd_ghostnet/train.py index 5a9192a770..1774f72f2a 100644 --- a/model_zoo/research/cv/ssd_ghostnet/train.py +++ b/model_zoo/research/cv/ssd_ghostnet/train.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and @@ -32,7 +32,10 @@ from src.lr_schedule import get_lr from src.init_params import init_net_param, filter_checkpoint_parameter -def main(): +def get_args(): + """ + Parse arguments + """ parser = argparse.ArgumentParser(description="SSD training") parser.add_argument("--only_create_dataset", type=ast.literal_eval, default=False, help="If set it true, only create Mindrecord, default is False.") @@ -47,7 +50,7 @@ def main(): parser.add_argument("--mode", type=str, default="sink", help="Run sink mode or not, default is sink.") parser.add_argument("--dataset", type=str, default="coco", - help="Dataset, defalut is coco.") + help="Dataset, default is coco.") parser.add_argument("--epoch_size", type=int, default=500, help="Epoch size, default is 500.") parser.add_argument("--batch_size", type=int, default=32, @@ -63,7 +66,10 @@ def main(): parser.add_argument("--filter_weight", type=ast.literal_eval, default=False, help="Filter weight parameters, default is False.") args_opt = parser.parse_args() + return args_opt +def main(): + args_opt = get_args() context.set_context(mode=context.GRAPH_MODE, device_target="Ascend", device_id=args_opt.device_id) diff --git a/tests/st/model_zoo_tests/yolov3/test_yolov3.py b/tests/st/model_zoo_tests/yolov3/test_yolov3.py index 4a2dae066b..7a991c6244 100644 --- a/tests/st/model_zoo_tests/yolov3/test_yolov3.py +++ b/tests/st/model_zoo_tests/yolov3/test_yolov3.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and diff --git a/tests/st/model_zoo_tests/yolov3_darknet53/test_yolov3_darknet53.py b/tests/st/model_zoo_tests/yolov3_darknet53/test_yolov3_darknet53.py index 9b7f48f587..afd8a319d3 100644 --- a/tests/st/model_zoo_tests/yolov3_darknet53/test_yolov3_darknet53.py +++ b/tests/st/model_zoo_tests/yolov3_darknet53/test_yolov3_darknet53.py @@ -6,7 +6,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # -# less required by applicable law or agreed to in writing, software +# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and