diff --git a/dataset/dota_coco/dota_to_coco.py b/dataset/dota_coco/dota_to_coco.py index 87a9dbcfb925110686dba856d44193c94518d7be..3aa557b8b3f9bce0a8637ca1a9266ab298ea23fc 100644 --- a/dataset/dota_coco/dota_to_coco.py +++ b/dataset/dota_coco/dota_to_coco.py @@ -90,7 +90,7 @@ def dota_2_coco(image_dir, # annotations anno_txt_path = osp.join(txt_dir, osp.splitext(basename)[0] + '.txt') if not osp.exists(anno_txt_path): - logger.warn('path of {} not exists'.format(anno_txt_path)) + logger.warning('path of {} not exists'.format(anno_txt_path)) for line in open(anno_txt_path): line = line.strip() diff --git a/ppdet/core/config/schema.py b/ppdet/core/config/schema.py index 0d2b0dabf65e615af79a70e27a868a6063b8b2d9..2e41b5c34693a709fa61d47489f6934ead0c17e0 100644 --- a/ppdet/core/config/schema.py +++ b/ppdet/core/config/schema.py @@ -185,12 +185,12 @@ def extract_schema(cls): annotations = argspec.annotations has_kwargs = argspec.varkw is not None else: - argspec = inspect.getargspec(ctor) + argspec = inspect.getfullargspec(ctor) # python 2 type hinting workaround, see pep-3107 # however, since `typeguard` does not support python 2, type checking # is still python 3 only for now annotations = getattr(ctor, '__annotations__', {}) - has_kwargs = argspec.keywords is not None + has_kwargs = argspec.varkw is not None names = [arg for arg in argspec.args if arg != 'self'] defaults = argspec.defaults diff --git a/ppdet/core/config/yaml_helpers.py b/ppdet/core/config/yaml_helpers.py index 1545b6be72288a1faa82b662d3c409aa8fc84897..181cfe6fcd7368c6cadb32d1021a8c55a1d98aa5 100644 --- a/ppdet/core/config/yaml_helpers.py +++ b/ppdet/core/config/yaml_helpers.py @@ -52,7 +52,7 @@ def _make_python_representer(cls): if hasattr(inspect, 'getfullargspec'): argspec = inspect.getfullargspec(cls) else: - argspec = inspect.getargspec(cls.__init__) + argspec = inspect.getfullargspec(cls.__init__) argnames = [arg for arg in argspec.args if arg != 'self'] def python_representer(dumper, obj): diff --git a/ppdet/data/reader.py b/ppdet/data/reader.py index b3256c89ece92d83fab2dee3799f515353ef7e0e..a4de16496969bf5ce8a196da56105d5efe9b7f54 100644 --- a/ppdet/data/reader.py +++ b/ppdet/data/reader.py @@ -55,9 +55,9 @@ class Compose(object): data = f(data) except Exception as e: stack_info = traceback.format_exc() - logger.warn("fail to map sample transform [{}] " - "with error: {} and stack:\n{}".format( - f, e, str(stack_info))) + logger.warning("fail to map sample transform [{}] " + "with error: {} and stack:\n{}".format( + f, e, str(stack_info))) raise e return data @@ -74,9 +74,9 @@ class BatchCompose(Compose): data = f(data) except Exception as e: stack_info = traceback.format_exc() - logger.warn("fail to map batch transform [{}] " - "with error: {} and stack:\n{}".format( - f, e, str(stack_info))) + logger.warning("fail to map batch transform [{}] " + "with error: {} and stack:\n{}".format( + f, e, str(stack_info))) raise e # remove keys which is not needed by model @@ -184,8 +184,8 @@ class BaseDataLoader(object): if use_shared_memory: shm_size = _get_shared_memory_size_in_M() if shm_size is not None and shm_size < 1024.: - logger.warn("Shared memory size is less than 1G, " - "disable shared_memory in DataLoader") + logger.warning("Shared memory size is less than 1G, " + "disable shared_memory in DataLoader") use_shared_memory = False self.dataloader = DataLoader( diff --git a/ppdet/data/source/category.py b/ppdet/data/source/category.py index c0188b97b870f539920fc224bea85a3ca5138b3a..b25e840897745fbbd931efd396deed62e9ed3e75 100644 --- a/ppdet/data/source/category.py +++ b/ppdet/data/source/category.py @@ -77,7 +77,7 @@ def get_categories(metric_type, anno_file=None, arch=None): elif metric_type.lower() == 'oid': if anno_file and os.path.isfile(anno_file): - logger.warn("only default categories support for OID19") + logger.warning("only default categories support for OID19") return _oid19_category() elif metric_type.lower() == 'widerface': diff --git a/ppdet/data/source/mot.py b/ppdet/data/source/mot.py index 1e61f440812f905b0f8eeb539530765cea84e6f3..feb543d0ec1d1cf84d6c12c8a7944b7418194ebf 100644 --- a/ppdet/data/source/mot.py +++ b/ppdet/data/source/mot.py @@ -175,12 +175,12 @@ class MOTDataSet(DetDataset): lbl_file = self.label_files[data_name][img_index - start_index] if not os.path.exists(img_file): - logger.warn('Illegal image file: {}, and it will be ignored'. - format(img_file)) + logger.warning('Illegal image file: {}, and it will be ignored'. + format(img_file)) continue if not os.path.isfile(lbl_file): - logger.warn('Illegal label file: {}, and it will be ignored'. - format(lbl_file)) + logger.warning('Illegal label file: {}, and it will be ignored'. + format(lbl_file)) continue labels = np.loadtxt(lbl_file, dtype=np.float32).reshape(-1, 6) diff --git a/ppdet/data/source/voc.py b/ppdet/data/source/voc.py index 56b746c14cc23a60e148a4c84149a3553b48c927..1272626d7e5dbf169044a2112236dd5d35576951 100644 --- a/ppdet/data/source/voc.py +++ b/ppdet/data/source/voc.py @@ -89,13 +89,14 @@ class VOCDataSet(DetDataset): img_file, xml_file = [os.path.join(image_dir, x) \ for x in line.strip().split()[:2]] if not os.path.exists(img_file): - logger.warn( + logger.warning( 'Illegal image file: {}, and it will be ignored'.format( img_file)) continue if not os.path.isfile(xml_file): - logger.warn('Illegal xml file: {}, and it will be ignored'. - format(xml_file)) + logger.warning( + 'Illegal xml file: {}, and it will be ignored'.format( + xml_file)) continue tree = ET.parse(xml_file) if tree.find('id') is None: @@ -107,7 +108,7 @@ class VOCDataSet(DetDataset): im_w = float(tree.find('size').find('width').text) im_h = float(tree.find('size').find('height').text) if im_w < 0 or im_h < 0: - logger.warn( + logger.warning( 'Illegal width: {} or height: {} in annotation, ' 'and {} will be ignored'.format(im_w, im_h, xml_file)) continue @@ -137,7 +138,7 @@ class VOCDataSet(DetDataset): gt_score.append([1.]) difficult.append([_difficult]) else: - logger.warn( + logger.warning( 'Found an invalid bbox in annotations: xml_file: {}' ', x1: {}, y1: {}, x2: {}, y2: {}.'.format( xml_file, x1, y1, x2, y2)) diff --git a/ppdet/data/source/widerface.py b/ppdet/data/source/widerface.py index b1813b0e07035ad365b92d4d5f9125094ff015de..a17c2aaf8a20c0218f8833891f1f858715dce4b0 100644 --- a/ppdet/data/source/widerface.py +++ b/ppdet/data/source/widerface.py @@ -139,9 +139,9 @@ class WIDERFaceDataSet(DetDataset): h = float(split_str[3]) # Filter out wrong labels if w < 0 or h < 0: - logger.warn('Illegal box with w: {}, h: {} in ' - 'img: {}, and it will be ignored'.format( - w, h, file_dict[num_class][0])) + logger.warning('Illegal box with w: {}, h: {} in ' + 'img: {}, and it will be ignored'.format( + w, h, file_dict[num_class][0])) continue xmin = max(0, xmin) ymin = max(0, ymin) diff --git a/ppdet/data/transform/operators.py b/ppdet/data/transform/operators.py index 525c447631c7873edb47a1c09733edea1a1d2427..2053606dfdd4c80cf0482816fe47257bddcd0621 100644 --- a/ppdet/data/transform/operators.py +++ b/ppdet/data/transform/operators.py @@ -129,7 +129,7 @@ class Decode(BaseOperator): if 'h' not in sample: sample['h'] = im.shape[0] elif sample['h'] != im.shape[0]: - logger.warn( + logger.warning( "The actual image height: {} is not equal to the " "height: {} in annotation, and update sample['h'] by actual " "image height.".format(im.shape[0], sample['h'])) @@ -137,7 +137,7 @@ class Decode(BaseOperator): if 'w' not in sample: sample['w'] = im.shape[1] elif sample['w'] != im.shape[1]: - logger.warn( + logger.warning( "The actual image width: {} is not equal to the " "width: {} in annotation, and update sample['w'] by actual " "image width.".format(im.shape[1], sample['w'])) @@ -724,7 +724,7 @@ class Resize(BaseOperator): # apply rbox if 'gt_rbox2poly' in sample: if np.array(sample['gt_rbox2poly']).shape[1] != 8: - logger.warn( + logger.warning( "gt_rbox2poly's length shoule be 8, but actually is {}". format(len(sample['gt_rbox2poly']))) sample['gt_rbox2poly'] = self.apply_bbox(sample['gt_rbox2poly'], diff --git a/ppdet/engine/callbacks.py b/ppdet/engine/callbacks.py index 34f602c6d372a2b42059f84cad1b2e79e5de89db..70dbf33522398666f9bc5c0ba95ba6eddbbeff92 100644 --- a/ppdet/engine/callbacks.py +++ b/ppdet/engine/callbacks.py @@ -173,7 +173,7 @@ class Checkpointer(Callback): else: key = 'mask' if key not in map_res: - logger.warn("Evaluation results empty, this may be due to " \ + logger.warning("Evaluation results empty, this may be due to " \ "training iterations being too few or not " \ "loading the correct weights.") return diff --git a/ppdet/engine/tracker.py b/ppdet/engine/tracker.py index 9cc4ea25be8391c1810791816d7fd4ac921393bb..caaebfdaa54d1b70122c092b7231ee768dba1a6c 100644 --- a/ppdet/engine/tracker.py +++ b/ppdet/engine/tracker.py @@ -74,7 +74,7 @@ class Tracker(object): if self.cfg.metric == 'MOT': self._metrics = [MOTMetric(), ] else: - logger.warn("Metric not support for metric type {}".format( + logger.warning("Metric not support for metric type {}".format( self.cfg.metric)) self._metrics = [] diff --git a/ppdet/engine/trainer.py b/ppdet/engine/trainer.py index a4afd3b3d84fcea48259253d15038940d1d8ce00..5509e32e4ced189cd18434ec8e12fb595937494c 100644 --- a/ppdet/engine/trainer.py +++ b/ppdet/engine/trainer.py @@ -198,7 +198,7 @@ class Trainer(object): elif self.cfg.metric == 'ReID': self._metrics = [JDEReIDMetric(), ] else: - logger.warn("Metric not support for metric type {}".format( + logger.warning("Metric not support for metric type {}".format( self.cfg.metric)) self._metrics = [] diff --git a/static/ppdet/core/config/schema.py b/static/ppdet/core/config/schema.py index 0d2b0dabf65e615af79a70e27a868a6063b8b2d9..2e41b5c34693a709fa61d47489f6934ead0c17e0 100644 --- a/static/ppdet/core/config/schema.py +++ b/static/ppdet/core/config/schema.py @@ -185,12 +185,12 @@ def extract_schema(cls): annotations = argspec.annotations has_kwargs = argspec.varkw is not None else: - argspec = inspect.getargspec(ctor) + argspec = inspect.getfullargspec(ctor) # python 2 type hinting workaround, see pep-3107 # however, since `typeguard` does not support python 2, type checking # is still python 3 only for now annotations = getattr(ctor, '__annotations__', {}) - has_kwargs = argspec.keywords is not None + has_kwargs = argspec.varkw is not None names = [arg for arg in argspec.args if arg != 'self'] defaults = argspec.defaults diff --git a/static/ppdet/core/config/yaml_helpers.py b/static/ppdet/core/config/yaml_helpers.py index 1545b6be72288a1faa82b662d3c409aa8fc84897..181cfe6fcd7368c6cadb32d1021a8c55a1d98aa5 100644 --- a/static/ppdet/core/config/yaml_helpers.py +++ b/static/ppdet/core/config/yaml_helpers.py @@ -52,7 +52,7 @@ def _make_python_representer(cls): if hasattr(inspect, 'getfullargspec'): argspec = inspect.getfullargspec(cls) else: - argspec = inspect.getargspec(cls.__init__) + argspec = inspect.getfullargspec(cls.__init__) argnames = [arg for arg in argspec.args if arg != 'self'] def python_representer(dumper, obj): diff --git a/static/ppdet/core/workspace.py b/static/ppdet/core/workspace.py index 93e52eea2b7c2b30154b8e3ebe87a8ec4328f441..2b41dadfeac5f383dfa817123bf0582d85107fd5 100644 --- a/static/ppdet/core/workspace.py +++ b/static/ppdet/core/workspace.py @@ -166,8 +166,8 @@ def make_partial(cls): if not hasattr(op_module, op_name): import logging logger = logging.getLogger(__name__) - logger.warn('{} OP not found, maybe a newer version of paddle ' - 'is required.'.format(cls.__op__)) + logger.warning('{} OP not found, maybe a newer version of paddle ' + 'is required.'.format(cls.__op__)) return cls op = getattr(op_module, op_name) diff --git a/static/ppdet/data/parallel_map.py b/static/ppdet/data/parallel_map.py index 6e3a96beb233523fd523a03866a00fbc0c0aa024..fd64299b13b38cdc1be7b56976b487109eb08e08 100644 --- a/static/ppdet/data/parallel_map.py +++ b/static/ppdet/data/parallel_map.py @@ -210,10 +210,10 @@ class ParallelMap(object): else: errmsg = "consumer[{}] exit abnormally".format(w.ident) - logger.warn(errmsg) + logger.warning(errmsg) if abnormal_num > 0: - logger.warn("{} consumers have exited abnormally!!!" \ + logger.warning("{} consumers have exited abnormally!!!" \ .format(abnormal_num)) return abnormal_num == 0 @@ -238,7 +238,7 @@ class ParallelMap(object): if isinstance(sample, EndSignal): self._consumer_endsig[sample.id] = sample - logger.warn("recv endsignal from outq with errmsg[{}]" \ + logger.warning("recv endsignal from outq with errmsg[{}]" \ .format(sample.errmsg)) if len(self._consumer_endsig.keys()) < len(self._consumers): @@ -267,7 +267,7 @@ class ParallelMap(object): " for some consumers exited abnormally before!!!" if not self.drained(): - logger.warn("reset before epoch[{}] finishes".format( + logger.warning("reset before epoch[{}] finishes".format( self._epoch)) self._produced = self._produced - self._consumed else: diff --git a/static/ppdet/data/reader.py b/static/ppdet/data/reader.py index d19653078fa20cfd01ccf1f7c9dc670008c0b312..02dbf1091227a8cd4c9273d9cdc51007cdb79967 100644 --- a/static/ppdet/data/reader.py +++ b/static/ppdet/data/reader.py @@ -46,8 +46,9 @@ class Compose(object): data = f(data, ctx) except Exception as e: stack_info = traceback.format_exc() - logger.warn("fail to map op [{}] with error: {} and stack:\n{}". - format(f, e, str(stack_info))) + logger.warning( + "fail to map op [{}] with error: {} and stack:\n{}".format( + f, e, str(stack_info))) raise e return data diff --git a/static/ppdet/data/shared_queue/queue.py b/static/ppdet/data/shared_queue/queue.py index dea09e8ebd0ec5d1102b8be43534003bc1196751..3191d2c71e66a6e4d0f97640feb6be194235889e 100644 --- a/static/ppdet/data/shared_queue/queue.py +++ b/static/ppdet/data/shared_queue/queue.py @@ -74,7 +74,7 @@ class SharedQueue(Queue): stack_info = traceback.format_exc() err_msg = 'failed to put a element to SharedQueue '\ 'with stack info[%s]' % (stack_info) - logger.warn(err_msg) + logger.warning(err_msg) if buff is not None: buff.free() @@ -94,7 +94,7 @@ class SharedQueue(Queue): stack_info = traceback.format_exc() err_msg = 'failed to get element from SharedQueue '\ 'with stack info[%s]' % (stack_info) - logger.warn(err_msg) + logger.warning(err_msg) raise e finally: if buff is not None: diff --git a/static/ppdet/data/shared_queue/sharedmemory.py b/static/ppdet/data/shared_queue/sharedmemory.py index f5d7d2ca85b650f78ad80f93d99bf2f2c62be234..e92e84cb8483317f2c27682c88b402f951671614 100644 --- a/static/ppdet/data/shared_queue/sharedmemory.py +++ b/static/ppdet/data/shared_queue/sharedmemory.py @@ -231,7 +231,7 @@ class PageAllocator(object): fname = fname + '.' + str(uuid.uuid4())[:6] with open(fname, 'wb') as f: f.write(pickle.dumps(info, -1)) - logger.warn('dump alloc info to file[%s]' % (fname)) + logger.warning('dump alloc info to file[%s]' % (fname)) def _reset(self): alloc_page_pos = self._header_pages @@ -458,7 +458,7 @@ class SharedMemoryMgr(object): if start is None: time.sleep(0.1) if ct % 100 == 0: - logger.warn('not enough space for reason[%s]' % (errmsg)) + logger.warning('not enough space for reason[%s]' % (errmsg)) ct += 1 else: diff --git a/static/ppdet/data/source/coco.py b/static/ppdet/data/source/coco.py index 4c25875b319dc854bf0223f6c2e285b44442b6a2..f5322cf9ded9ecae41400ca6a808445273539573 100644 --- a/static/ppdet/data/source/coco.py +++ b/static/ppdet/data/source/coco.py @@ -97,8 +97,8 @@ class COCODataSet(DataSet): if 'annotations' not in coco.dataset: self.load_image_only = True - logger.warn('Annotation file: {} does not contains ground truth ' - 'and load image information only.'.format(anno_path)) + logger.warning('Annotation file: {} does not contains ground truth ' + 'and load image information only.'.format(anno_path)) for img_id in img_ids: img_anno = coco.loadImgs([img_id])[0] @@ -109,14 +109,14 @@ class COCODataSet(DataSet): im_path = os.path.join(image_dir, im_fname) if image_dir else im_fname if not os.path.exists(im_path): - logger.warn('Illegal image file: {}, and it will be ' - 'ignored'.format(im_path)) + logger.warning('Illegal image file: {}, and it will be ' + 'ignored'.format(im_path)) continue if im_w < 0 or im_h < 0: - logger.warn('Illegal width: {} or height: {} in annotation, ' - 'and im_id: {} will be ignored'.format(im_w, im_h, - img_id)) + logger.warning('Illegal width: {} or height: {} in annotation, ' + 'and im_id: {} will be ignored'.format( + im_w, im_h, img_id)) continue coco_rec = { @@ -141,7 +141,7 @@ class COCODataSet(DataSet): inst['clean_bbox'] = [x1, y1, x2, y2] bboxes.append(inst) else: - logger.warn( + logger.warning( 'Found an invalid bbox in annotations: im_id: {}, ' 'x1: {}, y1: {}, x2: {}, y2: {}.'.format( img_id, x1, y1, x2, y2)) diff --git a/static/ppdet/data/source/voc.py b/static/ppdet/data/source/voc.py index 84c5990c3745574e0878bc087876cd8dd28312af..8caae387843ef4af26b0aa4966fe3d21892adeda 100644 --- a/static/ppdet/data/source/voc.py +++ b/static/ppdet/data/source/voc.py @@ -111,13 +111,14 @@ class VOCDataSet(DataSet): img_file, xml_file = [os.path.join(image_dir, x) \ for x in line.strip().split()[:2]] if not os.path.exists(img_file): - logger.warn( + logger.warning( 'Illegal image file: {}, and it will be ignored'.format( img_file)) continue if not os.path.isfile(xml_file): - logger.warn('Illegal xml file: {}, and it will be ignored'. - format(xml_file)) + logger.warning( + 'Illegal xml file: {}, and it will be ignored'.format( + xml_file)) continue tree = ET.parse(xml_file) if tree.find('id') is None: @@ -129,7 +130,7 @@ class VOCDataSet(DataSet): im_w = float(tree.find('size').find('width').text) im_h = float(tree.find('size').find('height').text) if im_w < 0 or im_h < 0: - logger.warn( + logger.warning( 'Illegal width: {} or height: {} in annotation, ' 'and {} will be ignored'.format(im_w, im_h, xml_file)) continue @@ -156,7 +157,7 @@ class VOCDataSet(DataSet): is_crowd.append([0]) difficult.append([_difficult]) else: - logger.warn( + logger.warning( 'Found an invalid bbox in annotations: xml_file: {}' ', x1: {}, y1: {}, x2: {}, y2: {}.'.format( xml_file, x1, y1, x2, y2)) diff --git a/static/ppdet/data/source/widerface.py b/static/ppdet/data/source/widerface.py index 75da052349024f4981c91c201d9aea5c47d22ac4..ada33617fe6b0e053d63fb16383f57a292e39c06 100644 --- a/static/ppdet/data/source/widerface.py +++ b/static/ppdet/data/source/widerface.py @@ -133,9 +133,9 @@ class WIDERFaceDataSet(DataSet): h = float(split_str[3]) # Filter out wrong labels if w < 0 or h < 0: - logger.warn('Illegal box with w: {}, h: {} in ' - 'img: {}, and it will be ignored'.format( - w, h, file_dict[num_class][0])) + logger.warning('Illegal box with w: {}, h: {} in ' + 'img: {}, and it will be ignored'.format( + w, h, file_dict[num_class][0])) continue xmin = max(0, xmin) ymin = max(0, ymin) diff --git a/static/ppdet/data/transform/autoaugment_utils.py b/static/ppdet/data/transform/autoaugment_utils.py index 42963e276f4a0d6b5b022950aa246cf5379267b4..cfa89d374d94260c881566c12ef6a6afd5e823b9 100644 --- a/static/ppdet/data/transform/autoaugment_utils.py +++ b/static/ppdet/data/transform/autoaugment_utils.py @@ -1451,19 +1451,19 @@ def _parse_policy_info(name, prob, level, replace_value, augmentation_hparams): # Check to see if prob is passed into function. This is used for operations # where we alter bboxes independently. # pytype:disable=wrong-arg-types - if 'prob' in inspect.getargspec(func)[0]: + if 'prob' in inspect.getfullargspec(func)[0]: args = tuple([prob] + list(args)) # pytype:enable=wrong-arg-types # Add in replace arg if it is required for the function that is being called. - if 'replace' in inspect.getargspec(func)[0]: + if 'replace' in inspect.getfullargspec(func)[0]: # Make sure replace is the final argument - assert 'replace' == inspect.getargspec(func)[0][-1] + assert 'replace' == inspect.getfullargspec(func)[0][-1] args = tuple(list(args) + [replace_value]) # Add bboxes as the second positional argument for the function if it does # not already exist. - if 'bboxes' not in inspect.getargspec(func)[0]: + if 'bboxes' not in inspect.getfullargspec(func)[0]: func = bbox_wrapper(func) return (func, prob, args) @@ -1471,11 +1471,11 @@ def _parse_policy_info(name, prob, level, replace_value, augmentation_hparams): def _apply_func_with_prob(func, image, args, prob, bboxes): """Apply `func` to image w/ `args` as input with probability `prob`.""" assert isinstance(args, tuple) - assert 'bboxes' == inspect.getargspec(func)[0][1] + assert 'bboxes' == inspect.getfullargspec(func)[0][1] # If prob is a function argument, then this randomness is being handled # inside the function, so make sure it is always called. - if 'prob' in inspect.getargspec(func)[0]: + if 'prob' in inspect.getfullargspec(func)[0]: prob = 1.0 # Apply the function with probability `prob`. diff --git a/static/ppdet/data/transform/operators.py b/static/ppdet/data/transform/operators.py index 78ae281e9c1c652a319eda9bf354ee214934773b..a1cf788a76ee2514e889002062d2bba427bade24 100644 --- a/static/ppdet/data/transform/operators.py +++ b/static/ppdet/data/transform/operators.py @@ -125,7 +125,7 @@ class DecodeImage(BaseOperator): if 'h' not in sample: sample['h'] = im.shape[0] elif sample['h'] != im.shape[0]: - logger.warn( + logger.warning( "The actual image height: {} is not equal to the " "height: {} in annotation, and update sample['h'] by actual " "image height.".format(im.shape[0], sample['h'])) @@ -133,7 +133,7 @@ class DecodeImage(BaseOperator): if 'w' not in sample: sample['w'] = im.shape[1] elif sample['w'] != im.shape[1]: - logger.warn( + logger.warning( "The actual image width: {} is not equal to the " "width: {} in annotation, and update sample['w'] by actual " "image width.".format(im.shape[1], sample['w'])) diff --git a/static/ppdet/modeling/losses/yolo_loss.py b/static/ppdet/modeling/losses/yolo_loss.py index 553e633224b67ed15ed772be09acf35901fb7713..98f6ec37daf7e9bb50e0bb1f04c9c98f4a3a9900 100644 --- a/static/ppdet/modeling/losses/yolo_loss.py +++ b/static/ppdet/modeling/losses/yolo_loss.py @@ -67,7 +67,7 @@ class YOLOv3Loss(object): self.match_score = match_score if batch_size != -1: - logger.warn( + logger.warning( "config YOLOv3Loss.batch_size is deprecated, " "training batch size should be set by TrainReader.batch_size") diff --git a/static/ppdet/utils/download.py b/static/ppdet/utils/download.py index 2c53406e867da4a308642d012bc469b7231a92aa..d7e367a0526c3077052c3936844b9132a43e4160 100644 --- a/static/ppdet/utils/download.py +++ b/static/ppdet/utils/download.py @@ -321,7 +321,7 @@ def _download(url, path, md5sum=None): shutil.move(tmp_fullname, fullname) return fullname else: - logger.warn( + logger.warning( "Download from url imcomplete, try downloading again...") os.remove(tmp_fullname) continue diff --git a/static/slim/sensitive/sensitive.py b/static/slim/sensitive/sensitive.py index 56be07dbcbd5facf872d2b7e4831d8119a6212b0..903aa958398b4a123f5c23ecc6ef0bc627ab4eb4 100644 --- a/static/slim/sensitive/sensitive.py +++ b/static/slim/sensitive/sensitive.py @@ -104,7 +104,7 @@ def main(): if cfg.weights: checkpoint.load_params(exe, eval_prog, cfg.weights) else: - logger.warn("Please set cfg.weights to load trained model.") + logger.warning("Please set cfg.weights to load trained model.") # whether output bbox is normalized in model output layer is_bbox_normalized = False diff --git a/static/tools/anchor_cluster.py b/static/tools/anchor_cluster.py index 45baa028fe716829bab8d40b3ad2d4e5a6ac2a39..76b707a8836ad685da28e01d48a5dfb9ef157b9e 100644 --- a/static/tools/anchor_cluster.py +++ b/static/tools/anchor_cluster.py @@ -264,9 +264,9 @@ class YOLOv5AnchorCluster(BaseAnchorCluster): wh0 = self.whs i = (wh0 < 3.0).any(1).sum() if i: - logger.warn('Extremely small objects found. %d of %d' - 'labels are < 3 pixels in width or height' % - (i, len(wh0))) + logger.warning('Extremely small objects found. %d of %d' + 'labels are < 3 pixels in width or height' % + (i, len(wh0))) wh = wh0[(wh0 >= 2.0).any(1)] logger.info('Running kmeans for %g anchors on %g points...' % diff --git a/tools/anchor_cluster.py b/tools/anchor_cluster.py index b46664d62898ae9aed102b2030d71e80acf15b09..78ed3ea07dd348975054979000955074d914ccdd 100644 --- a/tools/anchor_cluster.py +++ b/tools/anchor_cluster.py @@ -251,9 +251,9 @@ class YOLOv5AnchorCluster(BaseAnchorCluster): wh0 = self.whs i = (wh0 < 3.0).any(1).sum() if i: - logger.warn('Extremely small objects found. %d of %d' - 'labels are < 3 pixels in width or height' % - (i, len(wh0))) + logger.warning('Extremely small objects found. %d of %d' + 'labels are < 3 pixels in width or height' % + (i, len(wh0))) wh = wh0[(wh0 >= 2.0).any(1)] logger.info('Running kmeans for %g anchors on %g points...' %