Skip to content

Commit

Permalink
init code
Browse files Browse the repository at this point in the history
  • Loading branch information
selimsef committed Jan 11, 2022
1 parent f182168 commit 4156871
Show file tree
Hide file tree
Showing 35 changed files with 3,450 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
venv/
logs/
all_weights/
.git/
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
ARG PYTORCH="1.10.0"
ARG CUDA="11.3"
ARG CUDNN="8"

FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel

ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
ENV CMAKE_PREFIX_PATH="$(dirname $(which conda))/../"
ENV PYTHONPATH=.

RUN pip install albumentations==1.0.0 timm==0.4.12 tensorboardx pandas madgrad
# Setting the working directory
WORKDIR /workspace

# Copying the required codebase
COPY . /workspace

RUN chmod 777 run_inference.sh

ENTRYPOINT [ "/workspace/run_inference.sh" ]

10 changes: 10 additions & 0 deletions conf_inf/b7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"network": "TimmUnet",
"encoder_params": {
"encoder": "tf_efficientnet_b7_ns",
"in_chans": 2,
"drop_path_rate": 0.2,
"pretrained": false,
"channels_last": false
}
}
32 changes: 32 additions & 0 deletions conf_inf/nf0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"network": "TimmUnet",
"encoder_params": {
"encoder": "nfnet_l0",
"in_chans": 2,
"pretrained": false,
"drop_path_rate": 0.25,
"channels_last": false
},
"crop_size": 1792,
"multiplier": 64,
"optimizer": {
"train_bs": 3,
"val_bs": 1,
"type": "SGD",
"learning_rate": 0.01,
"momentum": 0.9,
"nesterov": true,
"weight_decay": 1e-4,
"schedule": {
"type": "cosine",
"mode": "step",
"epochs": 120,
"params": {
"eta_min": 3e-4
}
}
},
"losses": [

]
}
9 changes: 9 additions & 0 deletions conf_inf/r34.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"network": "TimmUnet",
"encoder_params": {
"encoder": "resnet34",
"in_chans": 2,
"pretrained": false,
"channels_last": false
}
}
11 changes: 11 additions & 0 deletions conf_inf/v2ln.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"network": "TimmUnet",
"encoder_params": {
"encoder": "tf_efficientnetv2_l_in21k",
"in_chans": 2,
"drop_path_rate": 0.2,
"confidence_classes": 3,
"pretrained": false,
"channels_last": true
}
}
10 changes: 10 additions & 0 deletions conf_inf/v2m.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"network": "TimmUnet",
"encoder_params": {
"encoder": "tf_efficientnetv2_m_in21k",
"in_chans": 2,
"drop_path_rate": 0.2,
"pretrained": false,
"channels_last": true
}
}
77 changes: 77 additions & 0 deletions configs/b7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"network": "TimmUnet",
"encoder_params": {
"encoder": "tf_efficientnet_b7_ns",
"in_chans": 2,
"drop_path_rate": 0.2,
"pretrained": true,
"channels_last": false
},
"crop_size": 1728,
"multiplier": 64,
"optimizer": {
"train_bs": 2,
"val_bs": 1,
"type": "SGD",
"learning_rate": 0.003,
"weight_decay": 1e-4,
"nesterov": true,
"momentum": 0.9,
"schedule": {
"type": "cosine",
"mode": "step",
"epochs": 100,
"params": {
"eta_min": 5e-4
}
}
},
"losses": [
{
"name": "msk_v",
"type": "ComboLossCalculator",
"weight": 1.0,
"display": true,
"params": {
"field": "vessel_mask",
"weights": {
"bce": 1,
"focal": 3,
"dice": 1
}
}
},
{
"name": "msk_f",
"type": "ComboLossCalculator",
"weight": 2.0,
"display": true,
"params": {
"field": "fishing_mask",
"weights": {
"bce": 1,
"focal": 3,
"dice": 1
}
}
},

{
"name": "center",
"type": "CenterLossCalculator",
"weight": 2e-7,
"display": true,
"params": {
}
},
{
"name": "length",
"type": "LengthLoss",
"weight": 2,
"display": true,
"params": {
}
}

]
}
77 changes: 77 additions & 0 deletions configs/nf0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"network": "TimmUnet",
"encoder_params": {
"encoder": "nfnet_l0",
"in_chans": 2,
"drop_path_rate": 0.25,
"confidence_classes": 3,
"pretrained": true,
"channels_last": false

},
"crop_size": 1792,
"multiplier": 96,
"optimizer": {
"train_bs": 4,
"val_bs": 1,
"type": "SGD",
"learning_rate": 0.002,
"weight_decay": 1e-4,
"nesterov": true,
"momentum": 0.9,
"schedule": {
"type": "cosine",
"mode": "step",
"epochs": 100,
"params": {
"eta_min": 3e-4
}
}
},
"losses": [
{
"name": "msk_v",
"type": "ComboLossCalculator",
"weight": 1.0,
"display": true,
"params": {
"field": "vessel_mask",
"weights": {
"bce": 1,
"focal": 3,
"dice": 1
}
}
},
{
"name": "msk_f",
"type": "ComboLossCalculator",
"weight": 2.0,
"display": true,
"params": {
"field": "fishing_mask",
"weights": {
"bce": 1,
"focal": 3,
"dice": 1
}
}
},
{
"name": "center",
"type": "CenterLossCalculator",
"weight": 4e-7,
"display": true,
"params": {
}
},
{
"name": "length",
"type": "LengthLoss",
"weight": 2,
"display": true,
"params": {
}
}
]
}
Loading

0 comments on commit 4156871

Please sign in to comment.