d8627f9057fd69b48c758be5468480a3bb04b81e,examples/segnet/calc_weight.py,,,#,8
Before Change
n_cls_pixels[cls_i] += np.sum(lbl == cls_i)
n_img_pixels[cls_i] += lbl.size
freq = []
for n_cls_pixel, n_img_pixel in zip(n_cls_pixels, n_img_pixels):
freq.append(n_cls_pixel / n_img_pixel)
freq = np.array(freq)
median_freq = np.median(freq)
np.save("class_weight", median_freq / freq)
After Change
n_class = 12
dataset = CamVidDataset(split="train")
n_cls_pixels = np.zeros((n_class,))
n_img_pixels = np.zeros((n_class,))
for img, label in dataset:
for cls_i in np.unique(label):
n_cls_pixels[cls_i] += np.sum(label == cls_i)
n_img_pixels[cls_i] += label.size
freq = n_cls_pixels / n_img_pixels
median_freq = np.median(freq)
np.save("class_weight", median_freq / freq)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: chainer/chainercv
Commit Name: d8627f9057fd69b48c758be5468480a3bb04b81e
Time: 2017-05-28
Author: yuyuniitani@gmail.com
File Name: examples/segnet/calc_weight.py
Class Name:
Method Name:
Project Name: keras-team/keras
Commit Name: 002a9d5d2b2c26fff63293e3007ede9ab7dee616
Time: 2015-11-02
Author: makoto.matsuyama@gmx.com
File Name: keras/layers/core.py
Class Name: Merge
Method Name: output_shape
Project Name: NVIDIA/OpenSeq2Seq
Commit Name: f791b89909d8ac69cac38610a4b1ed31d219920d
Time: 2018-08-01
Author: chipn@nvidia.com
File Name: test.py
Class Name:
Method Name: