-
Notifications
You must be signed in to change notification settings - Fork 86
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except few comments.
|
||
class Div2k(Base): | ||
classes = [] | ||
num_classes = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess setting num_classes = 0
is for base class restriction.
It's not clear. Please add comment.
target_file = self.files[i] | ||
image = load_image(target_file) | ||
|
||
return image, None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above. None
label looks tricky.
@tsawada We need readability reviewer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ownership Approval.
blueoil/generate_lmnet_config.py
Outdated
@@ -127,7 +131,6 @@ def _blueoil_to_lmnet(blueoil_config): | |||
} | |||
dataset = {} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we remove a line here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My autopep8 removes unnecessary line break such as double empty line in functions.
Is this line necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line does not seem necessary but this diff is not related to the PR and thus should go into another PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely!
files = sorted(dataset.files) | ||
|
||
dataset_files = os.path.join(environment.DATA_DIR, "DIV2K/{}/*.png".format(type["dir"])) | ||
expected = sorted(glob(dataset_files)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected
should be hard coded
def test_length(set_test_environment, subset): | ||
dataset = Div2k(subset) | ||
|
||
assert len(dataset.files) == len(dataset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be hard coded
def test_num_per_epoch(set_test_environment, subset): | ||
dataset = Div2k(subset) | ||
|
||
assert len(dataset.files) == dataset.num_per_epoch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be hardcoded. Probably we should not use parametrize.
def test_get_item(set_test_environment, subset): | ||
dataset = Div2k(subset) | ||
|
||
for i in range(len(dataset)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either
for image, _ in dataset:
assert ...
or
assert all(isinstance(image, np.ndarray) for image, _ in dataset)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tsawada oops, thank you!!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! some minor comments...
blueoil/generate_lmnet_config.py
Outdated
@@ -127,7 +131,6 @@ def _blueoil_to_lmnet(blueoil_config): | |||
} | |||
dataset = {} | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line does not seem necessary but this diff is not related to the PR and thus should go into another PR.
def test_get_item(set_test_environment): | ||
dataset = Div2k("train") | ||
|
||
assert all([isinstance(image, np.ndarray) for image, _ in dataset]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to use list ([]
) here. Generator comprehension is better as it'll fail early.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not know that!
thank you!!
|
||
|
||
def test_train_files(set_test_environment): | ||
dataset = Div2k("train") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to bind everything into local variables.
assert sorted(Div2k("train")) == expected
is short and easy to understand.
Same for other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Python readability approval
🐍Thank you!
ARIGATO GOZAMASU! |
Motivation and Context
I want to implement a super-resolution network named DCSCN.
DNSCN uses the DIV2K dataset for train.
Description
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist: