Git Product home page Git Product logo

Comments (2)

lj107024 avatar lj107024 commented on August 15, 2024

thanks! I have got it. However, I meet another question, the ouput images Rounded-off Saliency Mask looks much better than Generated Saliency Mask , which is the real result of this method?
` for batch_idx, (img_np, img_tor) in enumerate(inf_dataloader, start=1):
img_tor = img_tor.to(device)
pred_masks, _ = model(img_tor)

        # Assuming batch_size = 1
        img_np = np.squeeze(img_np.numpy(), axis=0)
        img_np = img_np.astype(np.uint8)
        img_np = cv2.cvtColor(img_np, cv2.COLOR_RGB2BGR)
        pred_masks_raw = np.squeeze(pred_masks.cpu().numpy(), axis=(0, 1))
        pred_masks_round = np.squeeze(pred_masks.round().cpu().numpy(), axis=(0, 1)

        print('Image :', batch_idx)
        cv2.imshow('Input Image', img_np)
        cv2.imshow('Generated Saliency Mask', pred_masks_raw)
        cv2.imshow('Rounded-off Saliency Mask', pred_masks_round)`

from pytorch-pyramid-feature-attention-network-for-saliency-detection.

sairajk avatar sairajk commented on August 15, 2024

In the raw saliency mask pixel values are between 0 and 1 (this is the output directly from the model), while in the rounded off saliency mask the pixel values are either 0 or 1. The later one looks better as some of the surrounding noise is removed and the resultant mask is much sharper.

from pytorch-pyramid-feature-attention-network-for-saliency-detection.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.