netw0rkf10w / CRF

Conditional Random Fields
Apache License 2.0
23 stars 2 forks source link

Inquiry Regarding the Use of CRF with Grayscale Images #10

Open phonchi opened 2 months ago

phonchi commented 2 months ago

Dear Authors:

First of all, thank you for your excellent work. I am considering using your CNN-CRF model for a project involving grayscale images. I would appreciate your guidance on whether the existing code can be directly applied to grayscale images or if modifications are necessary.

Below is the segment of the suggested usuage of the code in the repository:

import torch

class CNNCRF(torch.nn.Module):
    """
    Simple CNN-CRF model
    """
    def __init__(self, cnn, crf):
        super().__init__()
        self.cnn = cnn
        self.crf = crf

    def forward(self, x):
        """
        x is a batch of input images
        """
        logits = self.cnn(x)
        logits = self.crf(x, logits)
        return logits

# Example of creating a CNN-CRF model from given `cnn` and `crf`
model = CNNCRF(cnn, crf)

Could you please advise if this code will function as intended with grayscale datasets, or are there specific adjustments or considerations we should be aware of?

Thank you for your assistance!