gurupradeep / fcn-for-semantic-segmentation Goto Github PK
View Code? Open in Web Editor NEWImplemention of FCN-8 and FCN-16 with Keras and uses CRF as post processing
License: MIT License
Implemention of FCN-8 and FCN-16 with Keras and uses CRF as post processing
License: MIT License
Hello,can you tell me how i can get the pascal-fcn16s-dag.mat which is used in fcn_16.ipynb
fcn16_model.load_weights('weights.h5'),Please explain the document 'weights.h5'
I tried running your code but I always come across an error that says weights.h5 cannot be found. I downloaded another weights file, but using that shows another error saying "you are trying to load a 0 layer model into a 19 layer model". Upon further digging I found out that this has something to do with the version of keras being used.
So my questions are:
Thank you
Hello, Thanks for sharing the code. But I have a question, why do I use the CRF code to come out like this?
PS: My train image data is three channel image. And my prediction image is already colored three-channel image data. I used the CRF function to pass in the original image, the colored image and the output image, I don't know if it's a mistake?
I want to use CRF.ipynb to post processing, I got an issue: module 'pydensecrf.densecrf' has no attribute 'DenseCRF2D'.
(before that :pip install pydensecrf)
Hello, thanks for your work, I have tried to rewrite your network using PyTorch, but what I got from the network is a coarse image where I can only see the profile of my segmentation object, would you like to tell me where I was wrong, thanks!
my model code is like this:
import torchvision.models as models
import torch.nn as nn
import torch.nn.functional as F
# referred to this site: https://github.com/Gurupradeep/FCN-for-Semantic-Segmentation
class MyFCN(nn.Module):
def __init__(self):
super().__init__()
model = models.vgg16(pretrained=True)
self.backbone_third = model.features[:17] # (256, 28, 28) third pooling before conv layer
self.backbone_fourth = model.features[:24] # (512, 14, 14) fourth pooling before conv layer
self.backbone_fifth = model.features[:31] # (512, 7, 7) final pooling before conv layer
self.conv_256_1 = nn.Sequential(
nn.Conv2d(256, 1, (1, 1), 1),
)
self.conv_512_1 = nn.Sequential(
nn.Conv2d(512, 1, (1, 1), 1),
)
# fc6
self.conv_512_4096 = nn.Sequential(
nn.Conv2d(512, 4096, (7, 7), 1, 3),
nn.ReLU(inplace=True),
)
# fc7
self.conv_4096_4096 = nn.Sequential(
nn.Conv2d(4096, 4096, (1, 1), 1),
nn.ReLU(inplace=True),
)
# score_fr
self.conv_4096_1 = nn.Sequential(
nn.Conv2d(4096, 1, (1, 1), 1),
nn.ReLU(inplace=True),
)
# score_2 for 7=>14 and 14=>28
self.conv_transpose = nn.Sequential(
nn.ConvTranspose2d(1, 1, (4, 4), 2),
)
# final upsample
self.conv_transpose_8 = nn.Sequential(
nn.ConvTranspose2d(1, 1, (16, 16), 8),
)
def forward(self, x):
x_from_pooling_3 = self.backbone_third(x)
x_from_pooling_4 = self.backbone_fourth(x)
x_from_pooling_5 = self.backbone_fifth(x)
# pooling 3
x_3 = self.conv_256_1(x_from_pooling_3)
# pooling 4
x_4 = self.conv_512_1(x_from_pooling_4) # (1, 1, 14, 14)
# pooling 5
x_5 = self.conv_512_4096(x_from_pooling_5) # (1, 4096, 7, 7)
x_5 = self.conv_4096_4096(x_5) # (1, 4096, 7, 7)
x_5 = self.conv_4096_1(x_5) # (1, 1, 7, 7)
x_5 = self.conv_transpose(x_5) # (1, 1, 16, 16)
x_5 = F.pad(x_5, (-1, -1, -1, -1)) # crop layer, (1, 1, 14, 14)
# fusing x_4
x_fused_1 = x_4 + x_5 # (1, 1, 14, 14)
x_fused_1 = self.conv_transpose(x_fused_1) # (1, 1, 30, 30)
x_fused_1 = F.pad(x_fused_1, (-1, -1, -1, -1)) # crop layer, (1, 1, 28, 28)
# fusing x_3
x_fused_2 = x_3 + x_fused_1
x_fused_2 = self.conv_transpose_8(x_fused_2) # (1, 1, 232, 232)
x_fused_2 = F.pad(x_fused_2, (-4, -4, -4, -4)) # crop layer (1, 1, 224, 224)
return x_fused_2
ValueError: Buffer has wrong number of dimensions (expected 3, got 2)
I just know the basics of neural networks, I tried understanding the paper. Can you give me some links to better understand the same?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.