INNER CODE UNIT · Python

train_img

MITDeepLearning/introtodeeplearning · mitdeeplearning/lab2.py:90

        train_img = (self.images[sorted_inds, :, :, ::-1] / 255.0).astype(np.float32)
        train_label = self.labels[sorted_inds, ...]

        if not self.channels_last:
            train_img = np.ascontiguousarray(
                np.transpose(train_img, (0, 3, 1, 2))
            )  # [B, H, W, C] -> [B, C, H, W]
        return (
            (train_img, train_label, sorted_inds)
            if return_inds
            else (train_img, train_label)
        )

    def get_n_most_prob_faces(self, prob, n):
        idx = np.argsort(prob)[::-1]
        most_prob_inds = self.pos_train_inds[idx[: 10 * n : 10]]
        return (self.images[most_prob_inds, ...] / 255.0).astype(np.float32)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…