Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sha256 for training data #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

add sha256 for training data #4

wants to merge 6 commits into from

Conversation

cakester
Copy link

Checklist

GitHub

  • I've given this PR a concise, self-descriptive, and meaningful title
  • I've linked relevant issues in the PR body
  • I've applied the relevant labels to this PR
  • I've assigned a reviewer

PR contents

Description

Linked issues

ivadomed#9

@cakester cakester requested a review from dyt811 March 26, 2021 16:51
@coveralls
Copy link

coveralls commented Mar 26, 2021

Pull Request Test Coverage Report for Build 698341617

  • 41 of 42 (97.62%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.1%) to 75.755%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ivadomed/main.py 11 12 91.67%
Totals Coverage Status
Change from base Build 686790450: 0.1%
Covered Lines: 5496
Relevant Lines: 7255

💛 - Coveralls

ivadomed/main.py Outdated
# generating sha256 for training data
context['training_sha256'] = {}
for file in train_lst:
df_sub = bids_df.df.loc[bids_df.df['filename'] == file]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a bit comment about this line in particular?

Copy link

@dyt811 dyt811 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff. I think more clarity will always help future developers or even you who look at this code down the road. Unit test is a mandatory requirement for IvadoMed. Be wary of its very convoluted pathing issue... which may cause problems. bigger than the SHA2 issue you are trying to fix. Test thoroughly.

ivadomed/main.py Outdated
Comment on lines 351 to 354
sha256_hash = hashlib.sha256()
with open(file_path, "rb") as f:
for byte_block in iter(lambda: f.read(4096), b""):
sha256_hash.update(byte_block)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a unit test for this portion and externalize this portion as a dedicated block hashing function?

ivadomed/main.py Outdated
@@ -342,6 +343,17 @@ def run_command(context, n_gif=0, thr_increment=None, resume_training=False):
context["loader_parameters"]
['subject_selection'])

# generating sha256 for training data
context['training_sha256'] = {}
for file in train_lst:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add comment clarifying what is in the file, is it a string representing file name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants