-
Notifications
You must be signed in to change notification settings - Fork 86
Refactor predict output #579
Refactor predict output #579
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.
@suttang
Nice PR!!
Please check few comments.
numpy array, JSON, and images if you want. | ||
|
||
Args: | ||
dest (str): paht to save file |
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.
typo in paht
.
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.
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.
fixed!
save_materials(dest, materials, step) | ||
|
||
|
||
def save_npy(dest, outputs, step): |
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 these function are not method of OutputWriter
?
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 prefer "Don't put in a method if you don't need it" mentality.
These functions don't need the state of OutputWriter
.
IMO, This makes these functions independent and easier to test.
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 see.
print("save json: {}".format(filepath)) | ||
|
||
|
||
def save_materials(dest, materials, step): |
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.
save_materials
looks general name. save_images
is not enough?
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.
One day we will come to deal with tasks other than images.
Named for that time.
If not, I will fix.
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 see. To the future.
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.
Go to the future!
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.
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, Approval
with open(filepath, "w") as f: | ||
f.write(json) | ||
|
||
print("save json: {}".format(filepath)) |
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.
we should not print
debugging information.
|
||
|
||
@pytest.fixture | ||
def temp_dir(): |
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.
with TemporaryDirectory() as t:
yield t.name
…lueoil into refactor/predict-output-writer
Motivation and Context
This PR related to #480
To refactor the code around predict result output, we need to create
OutputWriter
andOutputParser
I think.In this PR, I created OutputWriter class.
Description
How has this been tested?
make test
Screenshots (if appropriate):
Types of changes
Checklist: