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

Improve code readability and speed #41

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ajinkya-kulkarni
Copy link

  1. Used np.apply_along_axis to calculate stack_ instead of using a list comprehension.
  2. Used elif statements instead of multiple if statements to improve code readability.

1. Used np.apply_along_axis to calculate stack_ instead of using a list comprehension.
2. Used elif statements instead of multiple if statements to improve code readability.
@@ -25,7 +25,7 @@ def fit(self, target):
lab = rgb2lab(target)

# get summary statistics
stack_ = np.array([get_mean_std(x) for x in lab_split(lab)])
stack_ = np.apply_along_axis(get_mean_std, 1, lab_split(lab))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would write np.apply_along_axis(get_mean_std, axis=1, arr=lab_split(lab))

@@ -38,7 +38,7 @@ def normalize(self, I):
labs = lab_split(lab)

# get summary statistics from LAB
stack_ = np.array([get_mean_std(x) for x in labs])
stack_ = np.apply_along_axis(get_mean_std, 1, labs)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above.

@ajinkya-kulkarni
Copy link
Author

Done

@andreped
Copy link
Collaborator

andreped commented Apr 6, 2023

In order to merge, we need to run some unit tests. This is not possible, until you have replaced ubuntu-18.04 with ubuntu-20.04, as mentioned here (necessary as ubuntu-18.04 docker image is deprecated in GitHub Actions).

See here for where to change. Alternatively, you can pull latest from the main branch to your own fork's branches.

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.

2 participants