Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Segmentation fault (core dumped)' in image_harmonization #25

Closed
sd707589 opened this issue Feb 7, 2024 · 5 comments
Closed

'Segmentation fault (core dumped)' in image_harmonization #25

sd707589 opened this issue Feb 7, 2024 · 5 comments

Comments

@sd707589
Copy link

sd707589 commented Feb 7, 2024

Hi Author,

I ran your code "python test_image_harmonization.py", it always triggered a bug as below:

begin testing image_harmonization...
Segmentation fault (core dumped)

I found out there was something wrong with the 'CDTNet.pth'. No matter downloaded from the code automatically or from the modelscope.cn, the model just didn't work.

Btw, my Env:
OS - Ubuntu 20.04
GPU - Nvidia 4090
cuda - 11.3.r11.3
python - 3.8.5

Please help or fix the bug.

@bo-zhang-cs
Copy link
Collaborator

(1) The released code has been validated and did not raise any errors. (2) The provided information is unable to pinpoint the error. It is suggested to run the code step by step to identify the bug.

@sd707589
Copy link
Author

(1) The released code has been validated and did not raise any errors. (2) The provided information is unable to pinpoint the error. It is suggested to run the code step by step to identify the bug.

During debugging, I found the error raised from './libcom/image_harmonization/source/functions.py' line 489

class TrilinearInterpolationFunction(torch.autograd.Function):
    @staticmethod
    def forward(ctx, lut, x):
        x = x.contiguous()

        output = x.new(x.size())
        dim = lut.size()[-1]
        shift = dim ** 3
        binsize = 1.000001 / (dim-1)
        W = x.size(2)
        H = x.size(3)
        # batch = x.size(0)
        batch = x.size(1)
        
        assert 1 == trilinear.forward(lut, 
                                      x, 
                                      output,
                                      dim, 
                                      shift, 
                                      binsize, 
                                      W, 
                                      H, 
                                      batch)  # <======= Bug came from here

        int_package = torch.IntTensor([dim, shift, W, H, batch])

I followed the solution from HuiZeng/Image-Adaptive-3DLUT#70 , but still no work.
Still needing your help!

@bo-zhang-cs
Copy link
Collaborator

If your PyTorch version is not 1.10.1, please try installing this specific version of PyTorch and then reinstall the libcom library by running python setup.py install.

@sd707589
Copy link
Author

If your PyTorch version is not 1.10.1, please try installing this specific version of PyTorch and then reinstall the libcom library by running python setup.py install.

Thx for reply. I did exactly follow the installation instruction . And the "torch-related" libraries are:

open-clip-torch           2.7.0
pytorch-lightning         1.9.0
torch                     1.10.1
torchaudio                0.10.1
torchmetrics              1.3.0.post0
torchvision               0.11.2

But still no work.

@bo-zhang-cs
Copy link
Collaborator

The latest code has fixed the trilinear bugs for PyTorch version 1.11.0 or later. Please consider upgrading PyTorch and rebuilding the library. Hope this can help you. Alternatively, you can try the source code for image harmonization, the link to which is provided in our documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants