8215a34d3203f45254b06a63271fe8010d351e6f,UnetTraining.py,,get_training_weights,#,102
Before Change
def get_training_weights(y_train, n_classes):
weights = []
for label in range(n_classes):
weights.append(get_class_weights(y_train[:, label], n_classes=2))
print("Training weights: {0}".format(weights))
return np.array(weights)
def get_class_weights(labels_array, n_classes):
After Change
def get_training_weights(training_generator, nb_training_samples, n_classes=2):
counts = np.zeros((n_labels, n_classes))
i = 0
while i < nb_training_samples:
_, y_train = training_generator.next()
for label in range(n_labels):
counts[label, :] += np.bincount(np.array(y_train[:, label].ravel(), dtype=np.uint8), minlength=n_classes)
i += 1
return counts_to_weights(counts)
def counts_to_weights(array):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: ellisdg/3DUnetCNN
Commit Name: 8215a34d3203f45254b06a63271fe8010d351e6f
Time: 2017-02-20
Author: david.ellis@unmc.edu
File Name: UnetTraining.py
Class Name:
Method Name: get_training_weights
Project Name: geekcomputers/Python
Commit Name: 370e9904b001798fb6795170ca30d99f623ae1ce
Time: 2020-11-01
Author: yk66478@gmail.com
File Name: addition.py
Class Name:
Method Name:
Project Name: geekcomputers/Python
Commit Name: 540a1afef555acb0df0c0fa80642ea6156bcf2c8
Time: 2019-10-23
Author: abrahamguernsey@gmail.com
File Name: find_cube_root.py
Class Name:
Method Name: