From d1c6c1e1a7f7dda73a957f301209567d0848fcb8 Mon Sep 17 00:00:00 2001 From: George Ni Date: Thu, 12 Aug 2021 10:05:30 +0800 Subject: [PATCH] fix mot typo (#3953) --- deploy/python/mot_jde_infer.py | 3 +-- deploy/python/mot_sde_infer.py | 3 +-- deploy/python/utils.py | 1 - deploy/serving/test_client.py | 1 - docs/tutorials/FAQ/README.md | 1 - ppdet/data/transform/mot_operators.py | 6 ++++-- ppdet/engine/trainer.py | 1 + ppdet/modeling/losses/sparsercnn_loss.py | 2 +- 8 files changed, 8 insertions(+), 10 deletions(-) diff --git a/deploy/python/mot_jde_infer.py b/deploy/python/mot_jde_infer.py index 584fcb384..8e37d1b7a 100644 --- a/deploy/python/mot_jde_infer.py +++ b/deploy/python/mot_jde_infer.py @@ -251,8 +251,7 @@ def predict_video(detector, camera_id): if not os.path.exists(save_dir): os.makedirs(save_dir) cv2.imwrite( - os.path.join(save_dir, '{:05d}.jpg'.format(frame_id)), - im) + os.path.join(save_dir, '{:05d}.jpg'.format(frame_id)), im) else: writer.write(im) frame_id += 1 diff --git a/deploy/python/mot_sde_infer.py b/deploy/python/mot_sde_infer.py index 60a3fd7db..6e1a4036f 100644 --- a/deploy/python/mot_sde_infer.py +++ b/deploy/python/mot_sde_infer.py @@ -392,8 +392,7 @@ def predict_video(detector, reid_model, camera_id): if not os.path.exists(save_dir): os.makedirs(save_dir) cv2.imwrite( - os.path.join(save_dir, '{:05d}.jpg'.format(frame_id)), - im) + os.path.join(save_dir, '{:05d}.jpg'.format(frame_id)), im) else: writer.write(im) frame_id += 1 diff --git a/deploy/python/utils.py b/deploy/python/utils.py index 138cefcd3..c35364c01 100644 --- a/deploy/python/utils.py +++ b/deploy/python/utils.py @@ -229,4 +229,3 @@ def get_current_memory_mb(): meminfo = pynvml.nvmlDeviceGetMemoryInfo(handle) gpu_mem = meminfo.used / 1024. / 1024. return round(cpu_mem, 4), round(gpu_mem, 4), round(gpu_percent, 4) - diff --git a/deploy/serving/test_client.py b/deploy/serving/test_client.py index b6a688e22..176ef9e8f 100644 --- a/deploy/serving/test_client.py +++ b/deploy/serving/test_client.py @@ -41,4 +41,3 @@ fetch_map = client.predict( print(fetch_map) fetch_map["image"] = sys.argv[1] postprocess(fetch_map) - diff --git a/docs/tutorials/FAQ/README.md b/docs/tutorials/FAQ/README.md index d4541c7c3..67d688600 100644 --- a/docs/tutorials/FAQ/README.md +++ b/docs/tutorials/FAQ/README.md @@ -4,4 +4,3 @@ - [FAQ:第零期](./FAQ第零期.md) - [FAQ:第一期](./FAQ第一期.md) - diff --git a/ppdet/data/transform/mot_operators.py b/ppdet/data/transform/mot_operators.py index 5af64bb44..9ad9389a6 100644 --- a/ppdet/data/transform/mot_operators.py +++ b/ppdet/data/transform/mot_operators.py @@ -108,7 +108,9 @@ class LetterBoxResize(BaseOperator): if not isinstance(im, np.ndarray): raise TypeError("{}: image type is not numpy.".format(self)) if len(im.shape) != 3: - raise ImageError('{}: image is not 3-dimensional.'.format(self)) + from PIL import UnidentifiedImageError + raise UnidentifiedImageError( + '{}: image is not 3-dimensional.'.format(self)) # apply image height, width = self.target_size @@ -135,7 +137,7 @@ class MOTRandomAffine(BaseOperator): Args: degrees (list[2]): the rotate range to apply, transform range is [min, max] - translate (list[2]): the translate range to apply, ransform range is [min, max] + translate (list[2]): the translate range to apply, transform range is [min, max] scale (list[2]): the scale range to apply, transform range is [min, max] shear (list[2]): the shear range to apply, transform range is [min, max] borderValue (list[3]): value used in case of a constant border when appling diff --git a/ppdet/engine/trainer.py b/ppdet/engine/trainer.py index c7e80fffb..87712e8ad 100644 --- a/ppdet/engine/trainer.py +++ b/ppdet/engine/trainer.py @@ -17,6 +17,7 @@ from __future__ import division from __future__ import print_function import os +import sys import copy import time diff --git a/ppdet/modeling/losses/sparsercnn_loss.py b/ppdet/modeling/losses/sparsercnn_loss.py index 72b3b2fbc..d8fc3d117 100644 --- a/ppdet/modeling/losses/sparsercnn_loss.py +++ b/ppdet/modeling/losses/sparsercnn_loss.py @@ -357,7 +357,7 @@ def boxes_iou(boxes1, boxes2): ''' area1 = box_area(boxes1) area2 = box_area(boxes2) - + lt = paddle.maximum(boxes1.unsqueeze(-2)[:, :, :2], boxes2[:, :2]) rb = paddle.minimum(boxes1.unsqueeze(-2)[:, :, 2:], boxes2[:, 2:]) -- GitLab