Skip to content

Commit

Permalink
add sha256 for training data
Browse files Browse the repository at this point in the history
  • Loading branch information
cakester committed Mar 26, 2021
1 parent 5e402fe commit 069868b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ivadomed/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import platform
import multiprocessing
import re
import hashlib

from ivadomed.utils import logger
from ivadomed import evaluation as imed_evaluation
Expand Down Expand Up @@ -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:
df_sub = bids_df.df.loc[bids_df.df['filename'] == file]
file_path = df_sub['path'].values[0]
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)
context['training_sha256'][file] = sha256_hash.hexdigest()

# TESTING PARAMS
# Aleatoric uncertainty
if context['uncertainty']['aleatoric'] and context['uncertainty']['n_it'] > 0:
Expand Down

0 comments on commit 069868b

Please sign in to comment.