FlowNetPytorch icon indicating copy to clipboard operation
FlowNetPytorch copied to clipboard

Help for PIV Images

Open retmac172 opened this issue 4 years ago • 1 comments

Hi, I try to use this implementation in my term project. However, I use the PIV image dataset instead of flying chairs. This dataset is a bit different from flying chairs. Image size is 256x256 and images are monochrome instead RGB. I took them from https://github.com/shengzesnail/PIV_dataset. I try to implement modifications mentioned in this article(https://link.springer.com/article/10.1007%2Fs00348-019-2717-2) on FlowNetS. However, I really have a problem with the data augmentation part. I got many errors especially the dimensionality part. I had already modified the architecture. I modified model input/output channels and filter sizes, but dataset loading parts unfortunately too complicate for me. I used the flyingchairs.py file with changing image format from .ppm to .tif but it doesn't work well so far. Do you have any advice? I really stuck in here. Thank you for your help. I attached an error example that I got. Error

retmac172 avatar Jun 22 '21 19:06 retmac172

Haven't checked, but It seems to me that your images are grayscale. That would mean that the operation np.transpose(array, (2,0,1)) cannot be applied since there is not dimension 2. You can just remove it and replace it by adding a dimension at first.

class ArrayToTensor(object):
    """Converts a numpy.ndarray grayscale (H x W) to a torch.FloatTensor of shape (1 x H x W)."""

    def __call__(self, array):
        assert(isinstance(array, np.ndarray))
        # handle numpy array
        tensor = torch.from_numpy(array)
        # put it in CHW format
        return tensor.float().unsqueeze(0)

ClementPinard avatar Jun 22 '21 21:06 ClementPinard