Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generic precommit hooks #830

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ updates:
open-pull-requests-limit: 2
allow:
- dependency-name: "timm"
dependency-type: "all"
dependency-type: "all"
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
branches: [ master ]

jobs:

lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ venv.bak/
/site

# mypy
.mypy_cache/
.mypy_cache/
14 changes: 13 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-executables-have-shebangs
- id: check-case-conflict
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
Expand All @@ -9,4 +21,4 @@ repos:
hooks:
- id: flake8
args: [ --config=.flake8 ]
additional_dependencies: [ flake8-docstrings==1.6.0 ]
additional_dependencies: [ flake8-docstrings==1.6.0 ]
60 changes: 30 additions & 30 deletions HALLOFFAME.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,87 @@ Here you can find competitions, names of the winners and links to their solution

Please, follow these rules, when adding a solution to the "Hall of Fame":

1. Solution should be high rated (e.g. for Kaggle gold or silver medal)
1. Solution should be high rated (e.g. for Kaggle gold or silver medal)
2. There should be a description of the solution (post at the forum / code / blog post / paper / pre-print)


## Kaggle

### [Severstal: Steel Defect Detection](https://www.kaggle.com/c/severstal-steel-defect-detection)

- 1st place.
[Wuxi Jiangsu](https://www.kaggle.com/rguo97),
[Hongbo Zhu](https://www.kaggle.com/zhuhongbo),
[Yizhuo Yu](https://www.kaggle.com/paffpaffyu)
- 1st place.
[Wuxi Jiangsu](https://www.kaggle.com/rguo97),
[Hongbo Zhu](https://www.kaggle.com/zhuhongbo),
[Yizhuo Yu](https://www.kaggle.com/paffpaffyu)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/114254#latest-675874)]

- 5th place.
[Guanshuo Xu](https://www.kaggle.com/wowfattie)
- 5th place.
[Guanshuo Xu](https://www.kaggle.com/wowfattie)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/117208#latest-675385)]

- 9th place.
[Jacek Poplawski](https://www.linkedin.com/in/jacekpoplawski/)
- 9th place.
[Jacek Poplawski](https://www.linkedin.com/in/jacekpoplawski/)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/114297#latest-660842)]

- 10th place.
[Alexey Rozhkov](https://www.linkedin.com/in/alexisrozhkov)
[Alexey Rozhkov](https://www.linkedin.com/in/alexisrozhkov)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/114465#latest-659615)]

- 12th place.
[Pavel Iakubovskii](https://www.linkedin.com/in/pavel-iakubovskii/),
[Ilya Dobrynin](https://www.linkedin.com/in/ilya-dobrynin-79a89b106/),
[Denis Kolpakov](https://www.linkedin.com/in/denis-kolpakov-ab3137197/)
- 12th place.
[Pavel Iakubovskii](https://www.linkedin.com/in/pavel-iakubovskii/),
[Ilya Dobrynin](https://www.linkedin.com/in/ilya-dobrynin-79a89b106/),
[Denis Kolpakov](https://www.linkedin.com/in/denis-kolpakov-ab3137197/)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/114309#latest-661404)]

- 31st place.
[Insaf Ashrapov](https://www.linkedin.com/in/iashrapov/),
[Igor Krashenyi](https://www.linkedin.com/in/igor-krashenyi-38b89b98),
[Pavel Pleskov](https://www.linkedin.com/in/ppleskov),
[Anton Zakharenkov](https://www.linkedin.com/in/anton-zakharenkov/),
[Nikolai Popov](https://www.linkedin.com/in/nikolai-popov-b2157370/)
- 31st place.
[Insaf Ashrapov](https://www.linkedin.com/in/iashrapov/),
[Igor Krashenyi](https://www.linkedin.com/in/igor-krashenyi-38b89b98),
[Pavel Pleskov](https://www.linkedin.com/in/ppleskov),
[Anton Zakharenkov](https://www.linkedin.com/in/anton-zakharenkov/),
[Nikolai Popov](https://www.linkedin.com/in/nikolai-popov-b2157370/)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/114383#latest-658438)]
[[code](https://github.com/Diyago/Severstal-Steel-Defect-Detection)]

- 55th place.
[Karl Hornlund](https://www.linkedin.com/in/karl-hornlund/)
- 55th place.
[Karl Hornlund](https://www.linkedin.com/in/karl-hornlund/)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/114410#latest-672682)]
[[code](https://github.com/khornlund/severstal-steel-defect-detection)]

- Efficiency round 1st place.
[Stefan Stefanov](https://www.linkedin.com/in/stefan-stefanov-63a77b1)
[Stefan Stefanov](https://www.linkedin.com/in/stefan-stefanov-63a77b1)
[[description](https://www.kaggle.com/c/severstal-steel-defect-detection/discussion/117486#latest-674229)]


### [Understanding Clouds from Satellite Images](https://www.kaggle.com/c/understanding_cloud_organization)

- 2nd place.
[Andrey Kiryasov](https://www.kaggle.com/ekydna)
[Andrey Kiryasov](https://www.kaggle.com/ekydna)
[[description](https://www.kaggle.com/c/understanding_cloud_organization/discussion/118255#latest-678189)]

- 4th place.
[Ching-Loong Seow](https://www.linkedin.com/in/clseow/)
[Ching-Loong Seow](https://www.linkedin.com/in/clseow/)
[[description](https://www.kaggle.com/c/understanding_cloud_organization/discussion/118016#latest-677333)]

- 34th place.
[Karl Hornlund](https://www.linkedin.com/in/karl-hornlund/)
[Karl Hornlund](https://www.linkedin.com/in/karl-hornlund/)
[[description](https://www.kaggle.com/c/understanding_cloud_organization/discussion/118250#latest-678176)]
[[code](https://github.com/khornlund/understanding-cloud-organization)]

- 55th place.
[Pavel Iakubovskii](https://www.linkedin.com/in/pavel-iakubovskii/)
[Pavel Iakubovskii](https://www.linkedin.com/in/pavel-iakubovskii/)
[[description](https://www.kaggle.com/c/understanding_cloud_organization/discussion/118019#latest-678626)]

## Other platforms

### [MICCAI 2020 TN-SCUI challenge](https://tn-scui2020.grand-challenge.org/Home/)
### [MICCAI 2020 TN-SCUI challenge](https://tn-scui2020.grand-challenge.org/Home/)
- 1st place.
[Mingyu Wang](https://github.com/WAMAWAMA)
[Mingyu Wang](https://github.com/WAMAWAMA)
[[description](https://github.com/WAMAWAMA/TNSCUI2020-Seg-Rank1st)]
[[code](https://github.com/WAMAWAMA/TNSCUI2020-Seg-Rank1st)]

### [Open Cities AI Challenge: Segmenting Buildings for Disaster Resilience](https://www.drivendata.org/competitions/60/building-segmentation-disaster-resilience/)
- 1st place.
[Pavel Iakubovskii](https://www.linkedin.com/in/pavel-iakubovskii/).
[Pavel Iakubovskii](https://www.linkedin.com/in/pavel-iakubovskii/).
[[code and description](https://github.com/qubvel/open-cities-challenge)]

### [Machine Learning based feature extraction of Electrical Substations from Satellite Data ](https://competitions.codalab.org/competitions/32132#learn_the_details)
Expand Down
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<div align="center">
![logo](https://i.ibb.co/dc1XdhT/Segmentation-Models-V2-Side-1-1.png)
**Python library with Neural Networks for Image
Segmentation based on [PyTorch](https://pytorch.org/).**

[![Generic badge](https://img.shields.io/badge/License-MIT-<COLOR>.svg?style=for-the-badge)](https://github.com/qubvel/segmentation_models.pytorch/blob/master/LICENSE)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/qubvel/segmentation_models.pytorch/tests.yml?branch=master&style=for-the-badge)](https://github.com/qubvel/segmentation_models.pytorch/actions/workflows/tests.yml)
[![Read the Docs](https://img.shields.io/readthedocs/smp?style=for-the-badge&logo=readthedocs&logoColor=white)](https://smp.readthedocs.io/en/latest/)

![logo](https://i.ibb.co/dc1XdhT/Segmentation-Models-V2-Side-1-1.png)
**Python library with Neural Networks for Image
Segmentation based on [PyTorch](https://pytorch.org/).**

[![Generic badge](https://img.shields.io/badge/License-MIT-<COLOR>.svg?style=for-the-badge)](https://github.com/qubvel/segmentation_models.pytorch/blob/master/LICENSE)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/qubvel/segmentation_models.pytorch/tests.yml?branch=master&style=for-the-badge)](https://github.com/qubvel/segmentation_models.pytorch/actions/workflows/tests.yml)
[![Read the Docs](https://img.shields.io/readthedocs/smp?style=for-the-badge&logo=readthedocs&logoColor=white)](https://smp.readthedocs.io/en/latest/)
<br>
[![PyPI](https://img.shields.io/pypi/v/segmentation-models-pytorch?color=blue&style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/segmentation-models-pytorch/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/segmentation-models-pytorch?style=for-the-badge&color=blue)](https://pepy.tech/project/segmentation-models-pytorch)
[![PyPI](https://img.shields.io/pypi/v/segmentation-models-pytorch?color=blue&style=for-the-badge&logo=pypi&logoColor=white)](https://pypi.org/project/segmentation-models-pytorch/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/segmentation-models-pytorch?style=for-the-badge&color=blue)](https://pepy.tech/project/segmentation-models-pytorch)
<br>
[![PyTorch - Version](https://img.shields.io/badge/PYTORCH-1.4+-red?style=for-the-badge&logo=pytorch)](https://pepy.tech/project/segmentation-models-pytorch)
[![Python - Version](https://img.shields.io/badge/PYTHON-3.7+-red?style=for-the-badge&logo=python&logoColor=white)](https://pepy.tech/project/segmentation-models-pytorch)
[![PyTorch - Version](https://img.shields.io/badge/PYTORCH-1.4+-red?style=for-the-badge&logo=pytorch)](https://pepy.tech/project/segmentation-models-pytorch)
[![Python - Version](https://img.shields.io/badge/PYTHON-3.7+-red?style=for-the-badge&logo=python&logoColor=white)](https://pepy.tech/project/segmentation-models-pytorch)

</div>

Expand All @@ -23,7 +23,7 @@ The main features of this library are:
- 124 available encoders (and 500+ encoders from [timm](https://github.com/rwightman/pytorch-image-models))
- All encoders have pre-trained weights for faster and better convergence
- Popular metrics and losses for training routines

### [📚 Project Documentation 📚](http://smp.readthedocs.io/)

Visit [Read The Docs Project Page](https://smp.readthedocs.io/) or read following README to know more about Segmentation Models Pytorch (SMP for short) library
Expand Down Expand Up @@ -358,7 +358,7 @@ The following is a list of supported encoders in the SMP. Select the appropriate

Backbone from SegFormer pretrained on Imagenet! Can be used with other decoders from package, you can combine Mix Vision Transformer with Unet, FPN and others!

Limitations:
Limitations:

- encoder is **not** supported by Linknet, Unet++
- encoder is supported by FPN only for encoder **depth = 5**
Expand Down Expand Up @@ -420,18 +420,18 @@ Total number of supported encoders: 549
##### Input channels
Input channels parameter allows you to create models, which process tensors with arbitrary number of channels.
If you use pretrained weights from imagenet - weights of first convolution will be reused. For
1-channel case it would be a sum of weights of first convolution layer, otherwise channels would be
1-channel case it would be a sum of weights of first convolution layer, otherwise channels would be
populated with weights like `new_weight[:, i] = pretrained_weight[:, i % 3]` and than scaled with `new_weight * 3 / new_in_channels`.
```python
model = smp.FPN('resnet34', in_channels=1)
mask = model(torch.ones([1, 1, 64, 64]))
```

##### Auxiliary classification output
All models support `aux_params` parameters, which is default set to `None`.
##### Auxiliary classification output
All models support `aux_params` parameters, which is default set to `None`.
If `aux_params = None` then classification auxiliary output is not created, else
model produce not only `mask`, but also `label` output with shape `NC`.
Classification head consists of GlobalPooling->Dropout(optional)->Linear->Activation(optional) layers, which can be
Classification head consists of GlobalPooling->Dropout(optional)->Linear->Activation(optional) layers, which can be
configured by `aux_params` as follows:
```python
aux_params=dict(
Expand Down Expand Up @@ -469,19 +469,19 @@ $ pip install git+https://github.com/qubvel/segmentation_models.pytorch

### 🤝 Contributing

#### Install SMP
#### Install SMP

```bash
make install_dev # create .venv, install SMP in dev mode
```

#### Run tests and code checks
#### Run tests and code checks

```bash
make all # run flake8, black, tests
```

#### Update table with encoders
#### Update table with encoders

```bash
make table # generate table with encoders and print to stdout
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM anibali/pytorch:cuda-9.0

RUN pip install segmentation-models-pytorch
RUN pip install segmentation-models-pytorch
1 change: 0 additions & 1 deletion docs/encoders_timm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1085,4 +1085,3 @@ Total number of encoders: 549
+----------------------------------+------------------+
| xception71 | ✅ |
+----------------------------------+------------------+

16 changes: 8 additions & 8 deletions docs/insights.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ Each encoder should have following attributes and methods and be inherited from
.. code-block:: python

class MyEncoder(torch.nn.Module, EncoderMixin):

def __init__(self, **kwargs):
super().__init__()

# A number of channels for each encoder feature tensor, list of integers
self._out_channels: List[int] = [3, 16, 64, 128, 256, 512]

# A number of stages in decoder (in other words number of downsampling operations), integer
# use in in forward pass to reduce number of returning features
self._depth: int = 5
self._depth: int = 5

# Default number of input channels in first Conv2d layer for encoder (usually 3)
self._in_channels: int = 3
self._in_channels: int = 3

# Define encoder modules below
...

Expand Down Expand Up @@ -90,12 +90,12 @@ For better understanding see more examples of encoder in smp.encoders module.
3. Aux classification output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

All models support ``aux_params`` parameter, which is default set to ``None``.
All models support ``aux_params`` parameter, which is default set to ``None``.
If ``aux_params = None`` than classification auxiliary output is not created, else
model produce not only ``mask``, but also ``label`` output with shape ``(N, C)``.

Classification head consist of following layers:

1. GlobalPooling
2. Dropout (optional)
3. Linear
Expand All @@ -104,7 +104,7 @@ Classification head consist of following layers:
Example:

.. code-block:: python

aux_params=dict(
pooling='avg', # one of 'avg', 'max'
dropout=0.5, # dropout ratio, default is None
Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Latest version from source:

.. code-block:: bash

$ pip install -U git+https://github.com/qubvel/segmentation_models.pytorch
$ pip install -U git+https://github.com/qubvel/segmentation_models.pytorch
2 changes: 1 addition & 1 deletion docs/losses.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
📉 Losses
=========

Collection of popular semantic segmentation losses. Adapted from
Collection of popular semantic segmentation losses. Adapted from
an awesome repo with pytorch utils https://github.com/BloodAxe/pytorch-toolbelt

Constants
Expand Down
2 changes: 0 additions & 2 deletions docs/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,3 @@ DeepLabV3
DeepLabV3+
~~~~~~~~~~
.. autoclass:: segmentation_models_pytorch.DeepLabV3Plus


2 changes: 1 addition & 1 deletion docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Segmentation model is just a PyTorch nn.Module, which can be created as easy as:

.. code-block:: python

import segmentation_models_pytorch as smp

model = smp.Unet(
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
faculty-sphinx-theme==0.2.2
six==1.15.0
autodocsumm
autodocsumm