Skip to content

Commit

Permalink
BUG: Fixing after breaking regressor name refactor (#88)
Browse files Browse the repository at this point in the history
* initial commit, implemented

* fixed the follow up bug on gui init
  • Loading branch information
AhmetCanSolak authored Jan 25, 2022
1 parent 4e363c7 commit 993888c
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 32 deletions.
19 changes: 9 additions & 10 deletions aydin/gui/tabs/qt/denoise.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(self, parent):
'Noise2SelfCNN-jinet',
'Noise2SelfFGR-cb',
'Noise2SelfFGR-lgbm',
'Noise2SelfFGR-rf',
'Noise2SelfFGR-random_forest',
]

self.basic_backend_options_descriptions = []
Expand Down Expand Up @@ -136,16 +136,15 @@ def set_advanced_enabled(self, enable: bool = False):
while self.stacked_widget.count():
self.stacked_widget.removeWidget(self.stacked_widget.widget(0))

for index, backend_option in enumerate(
self.backend_options if enable else self.basic_backend_options
):
self.leftlist.insertItem(index, backend_option)
if enable:
options = self.backend_options
description_list = self.backend_options_descriptions
else:
options = self.basic_backend_options
description_list = self.basic_backend_options_descriptions

description_list = (
self.backend_options_descriptions
if enable
else self.basic_backend_options_descriptions
)
for index, backend_option in enumerate(options):
self.leftlist.insertItem(index, backend_option)

self.stacked_widget.addWidget(
DenoiseTabMethodWidget(
Expand Down
4 changes: 2 additions & 2 deletions aydin/it/demo/n2s/rf/2D_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from aydin.features.standard_features import StandardFeatureGenerator
from aydin.io.datasets import normalise, add_noise, pollen, newyork, lizard, characters
from aydin.it.fgr import ImageTranslatorFGR
from aydin.regression.rf import RFRegressor
from aydin.regression.random_forest import RandomForestRegressor
from aydin.util.log.log import Log


Expand All @@ -26,7 +26,7 @@ def demo(image, name):

generator = StandardFeatureGenerator()

regressor = RFRegressor(patience=32)
regressor = RandomForestRegressor(patience=32)

it = ImageTranslatorFGR(feature_generator=generator, regressor=regressor)

Expand Down
8 changes: 4 additions & 4 deletions aydin/it/test/test_fgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from aydin.regression.lgbm import LGBMRegressor
from aydin.regression.linear import LinearRegressor
from aydin.regression.nn import NNRegressor
from aydin.regression.rf import RFRegressor
from aydin.regression.sv import SVRegressor
from aydin.regression.random_forest import RandomForestRegressor
from aydin.regression.support_vector import SupportVectorRegressor


@pytest.mark.heavy
Expand All @@ -24,13 +24,13 @@ def test_it_fgr_linear():


def test_it_fgr_rf():
regressor = RFRegressor(max_num_estimators=128)
regressor = RandomForestRegressor(max_num_estimators=128)
do_it_fgr_with_self_supervised(regressor, min_ssim=0.75)


@pytest.mark.heavy
def test_it_fgr_svr():
regressor = SVRegressor()
regressor = SupportVectorRegressor()
do_it_fgr_with_self_supervised(regressor, min_psnr=22, min_ssim=0.71)


Expand Down
8 changes: 4 additions & 4 deletions aydin/it/test/test_fgr_saveload.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from aydin.regression.lgbm import LGBMRegressor
from aydin.regression.linear import LinearRegressor
from aydin.regression.nn import NNRegressor
from aydin.regression.rf import RFRegressor
from aydin.regression.sv import SVRegressor
from aydin.regression.random_forest import RandomForestRegressor
from aydin.regression.support_vector import SupportVectorRegressor


@pytest.mark.heavy
Expand All @@ -28,13 +28,13 @@ def test_saveload_Linear():

@pytest.mark.heavy
def test_saveload_RF():
regressor = RFRegressor()
regressor = RandomForestRegressor()
saveload(StandardFeatureGenerator(), regressor, min_ssim=0.75)


@pytest.mark.heavy
def test_saveload_SVR():
regressor = SVRegressor()
regressor = SupportVectorRegressor()
saveload(StandardFeatureGenerator(), regressor, min_psnr=22, min_ssim=0.71)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aydin.util.log.log import lsection, lprint


class RFRegressor(LGBMRegressor):
class RandomForestRegressor(LGBMRegressor):
"""Random Forrest Regressor (uses the LGBM library)."""

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aydin.util.log.log import lprint, lsection


class SVRegressor(RegressorBase):
class SupportVectorRegressor(RegressorBase):
"""Support Vector Regressor.
\n\n
Note: Way too slow when non-linear, nearly useless...
Expand Down
8 changes: 4 additions & 4 deletions aydin/regression/test/deprecated_test_saveload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
from aydin.regression.lgbm import LGBMRegressor
from aydin.regression.linear import LinearRegressor
from aydin.regression.nn import NNRegressor
from aydin.regression.rf import RFRegressor
from aydin.regression.sv import SVRegressor
from aydin.regression.random_forest import RandomForestRegressor
from aydin.regression.support_vector import SupportVectorRegressor


def test_linear_saveload():
saveload(LinearRegressor(), min_ssim=0.70)


def test_rf_saveload():
saveload(RFRegressor(), min_ssim=0.70)
saveload(RandomForestRegressor(), min_ssim=0.70)


def test_svr_saveload():
saveload(SVRegressor(), min_ssim=0.70)
saveload(SupportVectorRegressor(), min_ssim=0.70)


def test_gbm_saveload():
Expand Down
8 changes: 4 additions & 4 deletions aydin/regression/test/test_regressors.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from aydin.regression.lgbm import LGBMRegressor
from aydin.regression.linear import LinearRegressor
from aydin.regression.nn import NNRegressor
from aydin.regression.rf import RFRegressor
from aydin.regression.sv import SVRegressor
from aydin.regression.random_forest import RandomForestRegressor
from aydin.regression.support_vector import SupportVectorRegressor


def test_linear_regressor():
Expand All @@ -23,12 +23,12 @@ def test_linear_regressor():


def test_rf_regressor():
regressor = RFRegressor()
regressor = RandomForestRegressor()
with_regressor(regressor, min_ssim=0.6)


def test_svr_regressor():
regressor = SVRegressor()
regressor = SupportVectorRegressor()
with_regressor(regressor, min_ssim=0.65)


Expand Down
4 changes: 2 additions & 2 deletions aydin/restoration/denoise/noise2selffgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from aydin.regression.lgbm import LGBMRegressor # noqa: F401
from aydin.regression.linear import LinearRegressor # noqa: F401
from aydin.regression.nn import NNRegressor # noqa: F401
from aydin.regression.rf import RFRegressor # noqa: F401
from aydin.regression.sv import SVRegressor # noqa: F401
from aydin.regression.random_forest import RandomForestRegressor # noqa: F401
from aydin.regression.support_vector import SupportVectorRegressor # noqa: F401


class Noise2SelfFGR(DenoiseRestorationBase):
Expand Down

0 comments on commit 993888c

Please sign in to comment.