diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 90f7ebab85..9448c7ade3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -49,3 +49,9 @@ repos: language: python files: ^configs/.*\.md$ require_serial: true + - repo: https://github.com/open-mmlab/pre-commit-hooks + rev: v0.2.0 # Use the rev to fix revision + hooks: + - id: check-algo-readme + - id: check-copyright + args: ["mmseg", "tools", "tests", "demo"] # the dir_to_check with expected directory to check diff --git a/demo/video_demo.py b/demo/video_demo.py index acdb531b7a..eb4fd69943 100644 --- a/demo/video_demo.py +++ b/demo/video_demo.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser import cv2 diff --git a/mmseg/datasets/coco_stuff.py b/mmseg/datasets/coco_stuff.py index 546a014284..24d0895565 100644 --- a/mmseg/datasets/coco_stuff.py +++ b/mmseg/datasets/coco_stuff.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .builder import DATASETS from .custom import CustomDataset diff --git a/mmseg/datasets/dark_zurich.py b/mmseg/datasets/dark_zurich.py index efc088f31b..0b6fda6e9e 100644 --- a/mmseg/datasets/dark_zurich.py +++ b/mmseg/datasets/dark_zurich.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .builder import DATASETS from .cityscapes import CityscapesDataset diff --git a/mmseg/datasets/isaid.py b/mmseg/datasets/isaid.py index 2b63d9273d..d6108b280b 100644 --- a/mmseg/datasets/isaid.py +++ b/mmseg/datasets/isaid.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import mmcv diff --git a/mmseg/datasets/night_driving.py b/mmseg/datasets/night_driving.py index a9289a27a4..6620586e3f 100644 --- a/mmseg/datasets/night_driving.py +++ b/mmseg/datasets/night_driving.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .builder import DATASETS from .cityscapes import CityscapesDataset diff --git a/mmseg/models/backbones/icnet.py b/mmseg/models/backbones/icnet.py index 10e5427858..6faaeab01c 100644 --- a/mmseg/models/backbones/icnet.py +++ b/mmseg/models/backbones/icnet.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from mmcv.cnn import ConvModule diff --git a/mmseg/models/backbones/twins.py b/mmseg/models/backbones/twins.py index b41325b880..6bd9469118 100644 --- a/mmseg/models/backbones/twins.py +++ b/mmseg/models/backbones/twins.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import math import warnings diff --git a/mmseg/models/decode_heads/dpt_head.py b/mmseg/models/decode_heads/dpt_head.py index a63f9d2972..6c895d02df 100644 --- a/mmseg/models/decode_heads/dpt_head.py +++ b/mmseg/models/decode_heads/dpt_head.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import math import torch diff --git a/mmseg/models/decode_heads/isa_head.py b/mmseg/models/decode_heads/isa_head.py index c9224b6102..0bf3455571 100644 --- a/mmseg/models/decode_heads/isa_head.py +++ b/mmseg/models/decode_heads/isa_head.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import math import torch diff --git a/mmseg/models/necks/ic_neck.py b/mmseg/models/necks/ic_neck.py index d836a6b9ce..a5d81cef8e 100644 --- a/mmseg/models/necks/ic_neck.py +++ b/mmseg/models/necks/ic_neck.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import torch.nn.functional as F from mmcv.cnn import ConvModule from mmcv.runner import BaseModule diff --git a/mmseg/models/utils/__init__.py b/mmseg/models/utils/__init__.py index 2417c51833..23f59b5d13 100644 --- a/mmseg/models/utils/__init__.py +++ b/mmseg/models/utils/__init__.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from .embed import PatchEmbed from .inverted_residual import InvertedResidual, InvertedResidualV3 from .make_divisible import make_divisible diff --git a/tests/test_apis/test_single_gpu.py b/tests/test_apis/test_single_gpu.py index b741896e59..0b484f201a 100644 --- a/tests/test_apis/test_single_gpu.py +++ b/tests/test_apis/test_single_gpu.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import shutil from unittest.mock import MagicMock diff --git a/tests/test_models/test_backbones/test_swin.py b/tests/test_models/test_backbones/test_swin.py index 4690001d33..8d14d47ab5 100644 --- a/tests/test_models/test_backbones/test_swin.py +++ b/tests/test_models/test_backbones/test_swin.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch diff --git a/tests/test_models/test_backbones/test_twins.py b/tests/test_models/test_backbones/test_twins.py index c7d4a8eb53..aa3eaf9f45 100644 --- a/tests/test_models/test_backbones/test_twins.py +++ b/tests/test_models/test_backbones/test_twins.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch diff --git a/tests/test_models/test_heads/test_dpt_head.py b/tests/test_models/test_heads/test_dpt_head.py index d8cd8b028d..0a6af610e1 100644 --- a/tests/test_models/test_heads/test_dpt_head.py +++ b/tests/test_models/test_heads/test_dpt_head.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch diff --git a/tests/test_models/test_utils/__init__.py b/tests/test_models/test_utils/__init__.py index e69de29bb2..ef101fec61 100644 --- a/tests/test_models/test_utils/__init__.py +++ b/tests/test_models/test_utils/__init__.py @@ -0,0 +1 @@ +# Copyright (c) OpenMMLab. All rights reserved. diff --git a/tools/browse_dataset.py b/tools/browse_dataset.py index d46487bf22..0aa9430ea0 100644 --- a/tools/browse_dataset.py +++ b/tools/browse_dataset.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import warnings diff --git a/tools/convert_datasets/coco_stuff10k.py b/tools/convert_datasets/coco_stuff10k.py index 4f0fd53060..374f819703 100644 --- a/tools/convert_datasets/coco_stuff10k.py +++ b/tools/convert_datasets/coco_stuff10k.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import shutil diff --git a/tools/convert_datasets/coco_stuff164k.py b/tools/convert_datasets/coco_stuff164k.py index 4533bf53b6..6d8e2f2a31 100644 --- a/tools/convert_datasets/coco_stuff164k.py +++ b/tools/convert_datasets/coco_stuff164k.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import shutil diff --git a/tools/convert_datasets/isaid.py b/tools/convert_datasets/isaid.py index e641ef8283..ff2ce2fcf5 100644 --- a/tools/convert_datasets/isaid.py +++ b/tools/convert_datasets/isaid.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import os diff --git a/tools/model_converters/vitjax2mmseg.py b/tools/model_converters/vitjax2mmseg.py index e3a0986ac6..585f408368 100644 --- a/tools/model_converters/vitjax2mmseg.py +++ b/tools/model_converters/vitjax2mmseg.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp diff --git a/tools/torchserve/test_torchserve.py b/tools/torchserve/test_torchserve.py index 59752853f4..432834a8d4 100644 --- a/tools/torchserve/test_torchserve.py +++ b/tools/torchserve/test_torchserve.py @@ -1,3 +1,4 @@ +# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser from io import BytesIO