-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
name: Do the code respects Python standards? | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10.0' | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
- name: Run pre-commit | ||
run: pre-commit run --all-files |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: 24.4.0 | ||
hooks: | ||
- id: black | ||
args: ['--line-length=120', '--verbose'] | ||
exclude: '^models/' | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: '7.0.0' | ||
hooks: | ||
- id: flake8 | ||
exclude: '^models/' | ||
|
||
- repo: https://github.com/pre-commit/mirrors-pylint | ||
rev: v3.0.0a5 | ||
hooks: | ||
- id: pylint | ||
name: pylint | ||
entry: pylint | ||
language: system | ||
args: ['.', '--rcfile=setup.cfg', '--fail-under=8'] | ||
exclude: '^models/' | ||
types: [python] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# inside models/deep_colorization/__init__.py | ||
from .colorizers import eccv16, siggraph17, load_img, preprocess_img, postprocess_tens |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
|
||
from .base_color import * | ||
from .eccv16 import * | ||
from .siggraph17 import * | ||
from .util import * | ||
|
||
from .base_color import BaseColor | ||
from .eccv16 import ECCVGenerator, eccv16 | ||
from .siggraph17 import SIGGRAPHGenerator, siggraph17 | ||
from .util import load_img, resize_img, preprocess_img, postprocess_tens |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
|
||
import torch | ||
from torch import nn | ||
|
||
class BaseColor(nn.Module): | ||
def __init__(self): | ||
super(BaseColor, self).__init__() | ||
|
||
self.l_cent = 50. | ||
self.l_norm = 100. | ||
self.ab_norm = 110. | ||
class BaseColor(nn.Module): | ||
def __init__(self): | ||
super(BaseColor, self).__init__() | ||
|
||
def normalize_l(self, in_l): | ||
return (in_l-self.l_cent)/self.l_norm | ||
self.l_cent = 50.0 | ||
self.l_norm = 100.0 | ||
self.ab_norm = 110.0 | ||
|
||
def unnormalize_l(self, in_l): | ||
return in_l*self.l_norm + self.l_cent | ||
def normalize_l(self, in_l): | ||
return (in_l - self.l_cent) / self.l_norm | ||
|
||
def normalize_ab(self, in_ab): | ||
return in_ab/self.ab_norm | ||
def unnormalize_l(self, in_l): | ||
return in_l * self.l_norm + self.l_cent | ||
|
||
def unnormalize_ab(self, in_ab): | ||
return in_ab*self.ab_norm | ||
def normalize_ab(self, in_ab): | ||
return in_ab / self.ab_norm | ||
|
||
def unnormalize_ab(self, in_ab): | ||
return in_ab * self.ab_norm |