-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: main
Are you sure you want to change the base?
Conversation
ajinkya-kulkarni
commented
Apr 2, 2023
- Used np.apply_along_axis to calculate stack_ instead of using a list comprehension.
- 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)) |
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 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) |
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.
Same as above.
Done |
In order to merge, we need to run some unit tests. This is not possible, until you have replaced See here for where to change. Alternatively, you can pull latest from the |