Skip to content

Commit 6494f83

Browse files
author
Jianfeng Wang
committed
chore(vision): pylint format (#76)
1 parent 5d22c2c commit 6494f83

File tree

12 files changed

+21
-6
lines changed

12 files changed

+21
-6
lines changed

official/vision/detection/layers/det/anchor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ class AnchorBoxGenerator(BaseAnchorGenerator):
6767
offset (float): center point offset. default is 0.5.
6868
"""
6969

70+
# pylint: disable=dangerous-default-value
7071
def __init__(
7172
self,
7273
anchor_scales: list = [[32], [64], [128], [256], [512]],
@@ -135,6 +136,7 @@ class AnchorPointGenerator(BaseAnchorGenerator):
135136
offset (float): center point offset. default is 0.5.
136137
"""
137138

139+
# pylint: disable=dangerous-default-value
138140
def __init__(
139141
self,
140142
num_anchors: int = 1,

official/vision/detection/layers/det/box_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def decode(self) -> Tensor:
3131

3232

3333
class BoxCoder(BoxCoderBase, metaclass=ABCMeta):
34+
# pylint: disable=dangerous-default-value
3435
def __init__(
3536
self,
3637
reg_mean=[0.0, 0.0, 0.0, 0.0],

official/vision/detection/layers/det/fpn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class FPN(M.Module):
4040
are produced by the backbone networks like ResNet.
4141
"""
4242

43+
# pylint: disable=dangerous-default-value
4344
def __init__(
4445
self,
4546
bottom_up: M.Module,

official/vision/detection/models/faster_rcnn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ def inference(self, features, im_info):
9999

100100

101101
class FasterRCNNConfig:
102+
# pylint: disable=too-many-statements
102103
def __init__(self):
103104
self.backbone = "resnet50"
104105
self.backbone_pretrained = True

official/vision/detection/tools/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def make_parser():
4747

4848

4949
def main():
50-
# pylint: disable=import-outside-toplevel
50+
# pylint: disable=import-outside-toplevel,too-many-branches,too-many-statements
5151
from pycocotools.coco import COCO
5252
from pycocotools.cocoeval import COCOeval
5353

official/vision/detection/tools/test_random.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
import megengine.distributed as dist
1717
from megengine.data import DataLoader
1818

19-
from official.vision.detection.tools.data_mapper import data_mapper
2019
from official.vision.detection.tools.utils import (
2120
InferenceSampler,
21+
PseudoDetectionDataset,
2222
DetEvaluator,
2323
import_from_file
2424
)
@@ -47,7 +47,7 @@ def make_parser():
4747

4848

4949
def main():
50-
# pylint: disable=import-outside-toplevel
50+
# pylint: disable=import-outside-toplevel,too-many-branches,too-many-statements
5151
from pycocotools.coco import COCO
5252
from pycocotools.cocoeval import COCOeval
5353

@@ -204,6 +204,7 @@ def worker(
204204
result_list.append(result)
205205

206206

207+
# pylint: disable=unused-argument
207208
def build_dataloader(rank, world_size, dataset_dir, cfg):
208209
val_dataset = PseudoDetectionDataset(length=5000, order=["image", "info"])
209210
val_sampler = InferenceSampler(val_dataset, 1, world_size=world_size, rank=rank)

official/vision/detection/tools/train.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ def build_dataset(dataset_dir, cfg):
233233
return data_mapper[data_name](**data_cfg)
234234

235235

236+
# pylint: disable=dangerous-default-value
236237
def build_sampler(train_dataset, batch_size, aspect_grouping=[1]):
237238
def _compute_aspect_ratios(dataset):
238239
aspect_ratios = []

official/vision/detection/tools/train_random.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99
import argparse
1010
import bisect
11-
import copy
1211
import multiprocessing as mp
1312
import os
1413
import time
@@ -21,7 +20,6 @@
2120
# from megengine.jit import trace
2221
from megengine.optimizer import SGD
2322

24-
from official.vision.detection.tools.data_mapper import data_mapper
2523
from official.vision.detection.tools.utils import (
2624
AverageMeter,
2725
DetectionPadCollator,
@@ -220,10 +218,12 @@ def adjust_learning_rate(optimizer, epoch, step, cfg, args):
220218
param_group["lr"] = base_lr * lr_factor
221219

222220

223-
def build_dataset(*args):
221+
# pylint: disable=unused-argument
222+
def build_dataset(dataset_dir, cfg):
224223
return PseudoDetectionDataset(order=["image", "boxes", "boxes_category", "info"])
225224

226225

226+
# pylint: disable=dangerous-default-value
227227
def build_sampler(train_dataset, batch_size, aspect_grouping=[1]):
228228
def _compute_aspect_ratios(dataset):
229229
aspect_ratios = []

official/vision/detection/tools/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ def __init__(self, dataset, batch_size=1, world_size=None, rank=None):
111111
end = min(self.num_samples * (self.rank + 1), len(self.dataset))
112112
self.indices = list(range(begin, end))
113113

114+
def sample(self):
115+
pass
116+
114117
def batch(self):
115118
step, length = self.batch_size, len(self.indices)
116119
batch_index = [self.indices[i : i + step] for i in range(0, length, step)]

official/vision/segmentation/tools/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ def compute_metric(result_list, cfg):
256256
k = (gt >= 0) & (gt < num_classes)
257257
labeled += np.sum(k)
258258
correct += np.sum((pred[k] == gt[k]))
259+
# pylint: disable=no-member
259260
hist += np.bincount(
260261
num_classes * gt[k].astype(int) + pred[k].astype(int),
261262
minlength=num_classes ** 2

0 commit comments

Comments
 (0)