Closed newExplore-hash closed 3 years ago
Hi @newExplore-hash ,
In brief, you don't need to install the latest InPlaceABNSync by yourself. The cuda files in ./modules
are compiled by Pytorch automatically.
As your own environmental problems, please refer to https://github.com/mapillary/inplace_abn/tree/v0.1.1 for some needed packages.
Moreover, if you only need inference, you can replace the InPlaceABNSync layer with one BatchNorm2D layer and one LeakyRelu layer in PyTorch.
Moreover, if you only need inference, you can replace the InPlaceABNSync layer with one BatchNorm2D layer and one LeakyRelu layer in PyTorch.
yes, i just use this for inference, i know the role of InPlaceABNSync is to reduce the memory required for training deep networks. So i use nn.BatchNorm2d and nn.LeakyReLU instead of InPlaceABNSync in the script of AugmentCE2P.py for inference, but there is a problem as following:
Traceback (most recent call last):
File "simple_extractor.py", line 166, in
this error just happened in Decoder_Module for self.conv3, and there is normal for PSPModule and Edge_Module and other operations(self.conv1 and self.conv2) for Decoder_Module .
this is code: class Decoder_Module(nn.Module): """ Parsing Branch Decoder Module. """
def __init__(self, num_classes):
super(Decoder_Module, self).__init__()
self.conv1 = nn.Sequential(
nn.Conv2d(512, 256, kernel_size=1, padding=0, dilation=1, bias=False),
InPlaceABNSync(256),
#######
nn.LeakyReLU()
)
self.conv2 = nn.Sequential(
nn.Conv2d(256, 48, kernel_size=1, stride=1, padding=0, dilation=1, bias=False),
InPlaceABNSync(48),
########
nn.LeakyReLU()
)
self.conv3 = nn.Sequential(
nn.Conv2d(304, 256, kernel_size=1, padding=0, dilation=1, bias=False),
InPlaceABNSync(256),
########
nn.LeakyReLU(),
nn.Conv2d(256, 256, kernel_size=1, padding=0, dilation=1, bias=False),
InPlaceABNSync(256),
#########
nn.LeakyReLU()
)
self.conv4 = nn.Conv2d(256, num_classes, kernel_size=1, padding=0, dilation=1, bias=True)
tks
I modified "networks/AugmentCE2P.py" which replace C++ extended “InPlaceABNSync” for inferencing on cpu successful!
# from ..modules import InPlaceABNSync
# BatchNorm2d = functools.partial(InPlaceABNSync, activation='none')
BatchNorm2d = nn.BatchNorm2d
class ReplacePlaceABNSync(BatchNorm2d):
def __init__(self, *args, **kwargs):
super(ReplacePlaceABNSync, self).__init__(*args, **kwargs)
self.act = nn.LeakyReLU()
def forward(self, input):
output = super(ReplacePlaceABNSync, self).forward(input)
output = self.act(output)
return output
@newExplore-hash
modifiy "networks/AugmentCE2P.py" as follow is better
# from ..modules import InPlaceABNSync
# BatchNorm2d = functools.partial(InPlaceABNSync, activation='none')
BatchNorm2d = nn.BatchNorm2d
class InPlaceABNSync(BatchNorm2d):
def __init__(self, *args, **kwargs):
super(InPlaceABNSync, self).__init__(*args, **kwargs)
self.act = nn.LeakyReLU()
def forward(self, input):
output = super(InPlaceABNSync, self).forward(input)
output = self.act(output)
return output
very appreciate your awesome work, but according to your brief description of the installation requirements, i found that this program can't run at all, and various bugs will appear. just like the error of Segmentation fault (core dumped) caused by InPlaceABNSync. i use batchnorm instead of InPlaceABNSync, but i found the performance is very bad.
tks