4cb6414084163db7fb5bf5f0e29a4c19009dcad0,rastervision_pytorch_learner/rastervision/pytorch_learner/semantic_segmentation_learner.py,SemanticSegmentationDataset,__getitem__,#SemanticSegmentationDataset#Any#,29

Before Change


        x = Image.open(img_path)
        y = Image.open(label_path)

        x = np.array(x)
        y = np.array(y)
        if self.transform is not None:
            out = self.transform(image=x, mask=y)
            x = out["image"]

After Change


                    ind: int) -> Tuple[torch.FloatTensor, torch.LongTensor]:

        img_path = self.img_paths[ind]
        label_path = self.label_paths[ind]

        x = self.img_load_fn(img_path)
        y = self.label_load_fn(label_path)

        if x.ndim == 2:
            // (h, w) --> (h, w, 1)
            x = x[..., np.newaxis]

        if self.transform is not None:
            out = self.transform(image=x, mask=y)
            x = out["image"]
            y = out["mask"]

        x = torch.from_numpy(x).permute(2, 0, 1).float()
        y = torch.from_numpy(y).long()

        return (x, y)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: azavea/raster-vision
Commit Name: 4cb6414084163db7fb5bf5f0e29a4c19009dcad0
Time: 2020-08-19
Author: AdeelH@users.noreply.github.com
File Name: rastervision_pytorch_learner/rastervision/pytorch_learner/semantic_segmentation_learner.py
Class Name: SemanticSegmentationDataset
Method Name: __getitem__


Project Name: mapbox/robosat
Commit Name: 4a486c33d7faa7938355658abca7e936022389b0
Time: 2018-10-02
Author: o@courtin.co
File Name: robosat/metrics.py
Class Name: MeanIoU
Method Name: add


Project Name: kengz/SLM-Lab
Commit Name: 2381a50a70559340a0335288d648b4bb9a675588
Time: 2018-06-12
Author: kengzwl@gmail.com
File Name: slm_lab/agent/algorithm/dqn.py
Class Name: MultitaskDQN
Method Name: act