patch_classification/run_model.py
def toTensor(image):
        "converts a single input image to tensor"
        # swap color axis because
        # numpy image: H x W x C
        # torch image: C X H X W
        image = image.transpose((2, 0, 1))
        return torch.from_numpy(image).float().unsqueeze(0)
converts a single input image to tensor
converts a single input image to tensor
converts a single input image to tensor
def toTensor(image):
        image = image.transpose((2, 0, 1))
        return torch.from_numpy(image).float().unsqueeze(0)
def toTensor ( image ) : image = image . transpose ( ( 2 , 0 , 1 ) ) return torch . from_numpy ( image ) . float ( ) . unsqueeze ( 0 )
converts a single input image to tensor
converts a single input image to tensor
"converts a single input image to tensor" # swap color axis because # numpy image: H x W x C # torch image: C X H X W
image