DeepLearning-SeGAN-Segmentation icon indicating copy to clipboard operation
DeepLearning-SeGAN-Segmentation copied to clipboard

Some questions about gt and cropinp

Open munanning opened this issue 7 years ago • 6 comments

You have offered a whole implementation of SEGAN, and they seems very interesting, but without the processed data, I couldn't run the whole program. So I wanna ask about some questions. My input are (none, 572, 572, 3), and the label is (none, 358, 358, n_labels=8), as the origin Unet, what should the gt be? Do I need change the input into gray(channel=1), then multiply the input and label to get images masked by ground-truth(I think it's the gt)? And should I do the same thing with the output of the netS(the input has 3 channel, but the output has 8, I can't simply use the multiply layer)? Btw, I found the old version without the crop operation.. It's easier to understand, but maybe it has a lower grades?

munanning avatar Oct 26 '17 03:10 munanning

Dear @godissaw , apologies for the late reply. I have been on leave and didn't check regularly. Basically, your question refers to when should the cropping of the ground truth data occur, right? For ground truth you can perform the multiplication prior to training if the label images have the same pixel format as the input images. For the learned labels it is more complicated. I included the option to perform a multiply (i.e. Cropping) in the last layer of the segmentor so its output looks the same as the cropped gt images. However, this cropping may have the drawback to artificially lower the loss between gt and learned labels. I haven't quite gotton my head around if this last segmentor layer is the right place to put it. Please let me know of your experience with it.

iNLyze avatar Nov 09 '17 23:11 iNLyze

thanks a lot. i am still trying to train my segan. i found only send the predict labels can not work, so i am trying sending both the labels and the image. i think the concat or multiply can give the critic the message of both the input and predict kabels, which is better than only sending labels.

munanning avatar Nov 10 '17 15:11 munanning

thanks your share, i have read your code, have a question, hope your reply: the method "ground_truth_mask_to_c" is aim to what. why u

        idx = self.rand_idx(self.n, nb_samples)   
        X = self.gt[idx]                            # this is GT
        while len(X.shape) < 4:
            X = np.expand_dims(X, axis=-1)
        X_pred = self.netS.predict(X)              

why u use modole predict GT?

silencemao avatar Nov 17 '17 13:11 silencemao

The method ground_truth_mask_to_C() feeds ground truth images to the critic. The critic is trained by feeding a gt image and a generated image alternatingly.

iNLyze avatar Nov 17 '17 21:11 iNLyze

but u use nets predict gt, i think it's not right. u should use the original gt just feed into critic, and another question at the segmentor last block,

last_block = upsampl_softmax(middle_blocks, out_ch+1, 3, 1, 2, self.max_project)
out = multiply([inp, last_block])  # crop input with predicted mask

your input shape is 1601603, if the last_block is made by above, so the last_block's shape is 1601602, when u use multiply([inp, last_block]), it will be wrong. Because the two parameters should have same shape or one is hwd and another is hw1. so hope your reply, thanks. my email is [email protected], may be email is more convenience.

silencemao avatar Nov 21 '17 08:11 silencemao

Have you discussed the problem mentioned above? Is there any problem with the current code?

yifanjiang19 avatar Dec 17 '17 08:12 yifanjiang19