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

Sourcery refactored master branch #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Jan 24, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from sulaimanvesal January 24, 2023 15:00
ids_train = df_train['img']
return ids_train
return df_train['img']
Copy link
Author

Choose a reason for hiding this comment

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

Function ImageProcessor.split_data refactored with the following changes:

Comment on lines -96 to +95
assert phase == "train" or phase == "valid", r"phase has to be either'train' or 'valid'"
assert phase in ["train", "valid"], r"phase has to be either'train' or 'valid'"
Copy link
Author

Choose a reason for hiding this comment

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

Function DataGenerator.__init__ refactored with the following changes:

Comment on lines -133 to +130
if self._phase == "train":
img_path = './input/images/{}.png'.format(id)
mask_path = './input/masks/{}.npy'.format(id)
else:
img_path = './input/images/{}.png'.format(id)
mask_path = './input/masks/{}.npy'.format(id)

mask_path = f'./input/masks/{id}.npy'
img_path = f'./input/images/{id}.png'
Copy link
Author

Choose a reason for hiding this comment

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

Function DataGenerator.get_image_paths refactored with the following changes:

Comment on lines -169 to +164
for i in range(self._batch_size):
for _ in range(self._batch_size):
indices.append(self._index)
self._index += 1
self._totalcount += 1
self._index = self._index % self._len
self._index %= self._len
Copy link
Author

Choose a reason for hiding this comment

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

Function DataGenerator.__next__ refactored with the following changes:

Comment on lines -54 to +55
plt.imsave('./results/pred_{}.png'.format(i), im)
plt.imsave('./results/gt_{}.png'.format(i), gt)
plt.imsave(f'./results/pred_{i}.png', im)
plt.imsave(f'./results/gt_{i}.png', gt)
Copy link
Author

Choose a reason for hiding this comment

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

Function predict_model refactored with the following changes:

Comment on lines -107 to -113
i = 0
output = x
for _, layer in self._modules.items():
for i, (_, layer) in enumerate(self._modules.items()):
output = layer(output)
if i % 2 == 0:
output = cat([skip.pop(), output], 1)
i += 1
Copy link
Author

Choose a reason for hiding this comment

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

Function Decoder.forward refactored with the following changes:

Comment on lines -130 to +116
if features_out:
return output, output_bottleneck
else:
return output
return (output, output_bottleneck) if features_out else output
Copy link
Author

Choose a reason for hiding this comment

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

Function Segmentation_model.forward refactored with the following changes:

assert mode=="max" or mode=="min", "mode can only be /'min/' or /'max/'"
assert mode in ["max", "min"], "mode can only be /'min/' or /'max/'"
Copy link
Author

Choose a reason for hiding this comment

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

Function EarlyStoppingCallback.__init__ refactored with the following changes:

assert mode=="max" or mode=="min", "mode can only be /'min/' or /'max/'"
assert mode in ["max", "min"], "mode can only be /'min/' or /'max/'"
Copy link
Author

Choose a reason for hiding this comment

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

Function ModelCheckPointCallback.__init__ refactored with the following changes:

if self.entire_model:
to_save = model
else:
to_save = model.state_dict()
to_save = model if self.entire_model else model.state_dict()
Copy link
Author

Choose a reason for hiding this comment

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

Function ModelCheckPointCallback.step refactored with the following changes:

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.

0 participants