cardwing / Codes-for-Lane-Detection

Learning Lightweight Lane Detection CNNs by Self Attention Distillation (ICCV 2019)
MIT License
1.04k stars 333 forks source link

While changing the input size (new resolution) , I encountered some issues. #328

Closed maheeeetaaa closed 2 years ago

maheeeetaaa commented 3 years ago

Hello,

I have been trying to train ERF_Net on CULane and I have encountered some issues:

first of all, I change the parameters image_height and width to half the original value. here is my train script:

!python3 -u train_erfnet.py CULane ERFNet ./train_gt ./val_gt \ --lr 0.01 \ --gpus 0 \ --resume ./pretrained/ERFNet_pretrained.tar \ -j 4 \ -b 32 \ --epochs 20 \ --img_height 104 \ --img_width 488 \ 2>&1|tee train_erfnet_culane.log

my first issue is that I need to change the size of two arrays in the original script erfnet.py otherwise it throws an error:

`class Lane_exist(nn.Module): def init(self, num_output): super().init()

    self.layers = nn.ModuleList()

    self.layers.append(nn.Conv2d(128, 32, (3, 3), stride=1, padding=(4, 4), bias=False, dilation=(4, 4)))
    self.layers.append(nn.BatchNorm2d(32, eps=1e-03))

    self.layers_final = nn.ModuleList()

    self.layers_final.append(nn.Dropout2d(0.1))
    self.layers_final.append(nn.Conv2d(32, 5, (1, 1), stride=1, padding=(0, 0), bias=True))

    self.maxpool = nn.MaxPool2d(2, stride=2)
    self.linear1 = nn.Linear(900, 128)
    self.linear2 = nn.Linear(128, 4)

def forward(self, input):
    output = input

    for layer in self.layers:
        output = layer(output)

    output = F.relu(output)

    for layer in self.layers_final:
        output = layer(output)

    output = F.softmax(output, dim=1)
    output = self.maxpool(output)
    print('output shape =',output.shape)
    output = output.view(-1, 900)
    output = self.linear1(output)
    output = F.relu(output)
    output = self.linear2(output)
    output = F.sigmoid(output)

    return output`

the 900m values in self.linear1 = nn.Linear(900, 128) is different from the original script and is based on the tensor's size. Doing so, the training doesn't throw an error but it doesn't learn.

is there anything specific I need to do when I want to change the resolution?

cardwing commented 3 years ago

What does "it doesn't learn" mean? Does it mean that the training loss does not decrease?