Git Product home page Git Product logo

linksense / lightnet Goto Github PK

View Code? Open in Web Editor NEW
715.0 29.0 175.0 89.78 MB

LightNet: Light-weight Networks for Semantic Image Segmentation (Cityscapes and Mapillary Vistas Dataset)

Home Page: https://ansleliu.github.io/LightNet.html

License: MIT License

Python 97.18% C 0.39% Shell 0.07% Cuda 1.40% C++ 0.96%
semantic-segmentation mobilenet-v2 deeplabv3plus wide-residual-networks pytorch cityscapes mapillary-vistas-dataset shufflenet inplace-activated-batchnorm mobilenet

lightnet's People

Contributors

ansleliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightnet's Issues

ModuleNotFoundError

File "c:\Users\Administrator\Desktop\LightNet-master\modules_ext_init_.py", line 2, in
from .__ext import lib as _lib, ffi as _ffi
ModuleNotFoundError: No module named 'modules._ext.__ext'

I can not find " .__ext" in your project
can you upload it?

ImageNet prtrained weights

@ansleliu , thanks for your nice work, but I am a little confused with your image pre-processing.
dd
ddd
Which kind of ImageNet pretrained weights are you using for mobinenet, since the img pre-processing is different from those pre-weights provided by caffe and pytorch?

Upgrade cffi to CppExtension in pytorch 1.0

Just for enchancement, this repo are helpful for build realtime segmentation applications, but now that Pytorch official has been depracted cffi, would that be a good idea to upgrade into CppExtenstion under modules cuda and cpp files?

The network can not be convergent

I feel very confused. I use the train_mobile.py to train the model with out pre-trained on the cityscapes dataset. I can only get the mIoU of 30~40. How can we get the mIoU of 70? How many epochs ?

How to train SE-WResNetV2?

I got some errors like:

RuntimeError: cuda runtime error (2) : out of memory

How to solve this problem?

Thanks

something wrong

warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

  1. Setting up DataLoader...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

Found 8925 train images...
Found 1500 val images...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

  1. Setting up Model...
    THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=74 error=30 : unknown error
    Traceback (most recent call last):
    File "train_mobile.py", line 374, in
    train(train_args, data_path, save_path)
    File "train_mobile.py", line 77, in train
    model = torch.nn.DataParallel(model, device_ids=[0,1]).cuda()
    File "/home/dl/anaconda2/envs/test_py3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 258, in cuda
    return self._apply(lambda t: t.cuda(device))
    File "/home/dl/anaconda2/envs/test_py3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 185, in _apply
    module._apply(fn)
    File "/home/dl/anaconda2/envs/test_py3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 185, in _apply
    module._apply(fn)
    File "/home/dl/anaconda2/envs/test_py3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 185, in _apply
    module._apply(fn)
    File "/home/dl/anaconda2/envs/test_py3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 191, in _apply
    param.data = fn(param.data)
    File "/home/dl/anaconda2/envs/test_py3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 258, in
    return self._apply(lambda t: t.cuda(device))

i don't know what to do ...

network model mobilenetplus

I don't know what that means. Can you elaborate on the specific function of this piece? Why use the 3x3 convolution kernel?

self.score = nn.Sequential(OrderedDict([("norm.1", norm_act(out_sec + in_stag2_up_chs)),
("conv.1", nn.Conv2d(out_sec + in_stag2_up_chs,
out_sec + in_stag2_up_chs,
kernel_size=3, stride=1, padding=2,
dilation=2, bias=False)),
("norm.2", norm_act(out_sec + in_stag2_up_chs)),
("conv.2", nn.Conv2d(out_sec + in_stag2_up_chs, self.n_class,
kernel_size=1, stride=1, padding=0,
bias=True)),
("up1", nn.Upsample(size=in_size, mode='bilinear'))]))

About pytorch encoding and the training speed

Hi,
Thank you for your great work! I am trying to do some distillation work on the small mobile net. I have some questions:
The code need the package pytorch encoding, but the pytorch encoding requires the pytorch to be 0.5.0. Your code is about pytorch 0.3.0+. I wonder how do you install the package of pytorch encoding?

However, the code can run under pytorch 0.5.0, but the training speed is very slow. I used a single P100 to have a try, and it need nearly 7 minutes to finish one epoch. If we need to train 10000 epochs, it will take nearly 48 days.
Is this because the different pytorch version?

Thanks,
Yifan

torch.FatalError: function_attributes(): after cudaFuncGetAttributes: invalid device function

The following error occurred when I ran the train_mobile_mvd:
/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages/torch/cuda/init.py:95: UserWarning:
Found GPU0 Tesla V100-SXM2-16GB which requires CUDA_VERSION >= 9000 for
optimal performance and fast startup time, but your PyTorch was compiled
with CUDA_VERSION 8000. Please install the correct PyTorch binary
using instructions from http://pytorch.org

warnings.warn(incorrect_binary_warn % (d, name, 9000, CUDA_VERSION))
^M 0%| | 0/9000 [00:00<?, ?it/s]['/workfs/lhhuang/segment/LightNet-master2/LightNet-master/scripts', '/workfs/lhhuang/segment/LightNet-master2/LightNet-master/scripts', '/dat01/lhhuang/models/research', '/dat01/lhhuang/models/research/slim', '/dat01/lhhuang/models/research/delf', '/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python36.zip', '/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6', '/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/lib-dynload', '/home/lhhuang/.local/lib/python3.6/site-packages', '/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages', '/workfs/lhhuang/segment/LightNet-master2/LightNet-master/datasets', '/workfs/lhhuang/segment/LightNet-master2/LightNet-master']

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

  1. Setting up DataLoader...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

There are 66 labels in the config file
Found 18000 training images...
There are 66 labels in the config file
Found 2000 validation images...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

  1. Setting up Model...
  2. Model Training start...
    ^M 0%| | 1/9000 [00:04<12:23:13, 4.96s/it]^M> Epoch [1/256]: 0%| | 1/9000 [00:04<12:23:13, 4.96s/it]Traceback (most recent call last):
    File "train_mobile_mvd.py", line 348, in
    train(train_args, data_path, save_path)
    File "train_mobile_mvd.py", line 185, in train
    out_stg1, out_stg2, out_stg3 = model(images) # Here we have 3 output for 3 loss
    File "/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in call
    result = self.forward(*input, **kwargs)
    File "/workfs/lhhuang/segment/LightNet-master2/LightNet-master/models/mobilenetv2plus.py", line 169, in forward
    de_stg1 = self.aspp(stg8)[1]
    File "/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in call
    result = self.forward(*input, **kwargs)
    File "/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages/torch/nn/modules/container.py", line 67, in forward
    input = module(input)
    File "/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in call
    result = self.forward(*input, **kwargs)
    File "/workfs/lhhuang/segment/LightNet-master2/LightNet-master/modules/misc.py", line 334, in forward
    x = self.in_norm(x)
    File "/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 357, in call
    result = self.forward(*input, **kwargs)
    File "/workfs/lhhuang/segment/LightNet-master2/LightNet-master/modules/bn.py", line 96, in forward
    self.activation, self.slope)
    File "/workfs/lhhuang/segment/LightNet-master2/LightNet-master/modules/functions.py", line 97, in forward
    _act_forward(ctx, x)
    File "/workfs/lhhuang/segment/LightNet-master2/LightNet-master/modules/functions.py", line 41, in _act_forward
    _ext.leaky_relu_cuda(x, ctx.slope)
    File "/workfs/lhhuang/anaconda3/envs/pytorch0.3/lib/python3.6/site-packages/torch/utils/ffi/init.py", line 180, in safe_call
    result = torch._C._safe_call(*args, **kwargs)
    torch.FatalError: function_attributes(): after cudaFuncGetAttributes: invalid device function

Train and Dataset issue

May I ask how to train model with both gtFine and gtCoarse dataset? And another question, how to get the model mIOU when test on val dataset?Thank you !

Train error with no CUDA-capable device is detected

I have build pytorch from source with CUDA 8 and cudnn 7 and installed pytroch-Encoding succesfully.
But when I try to train the model, it shows the following error.

➜ LightNet git:(master) ✗ python scripts/train_mobile.py

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

  1. Setting up DataLoader...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

Found 2975 train images...
Found 500 val images...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

  1. Setting up Model...
    THCudaCheck FAIL file=/home/kenzhang/pytorch/aten/src/THC/THCGeneral.cpp line=70 error=38 : no CUDA-capable device is detected
    Traceback (most recent call last):
    File "scripts/train_mobile.py", line 372, in
    train(train_args, data_path, save_path)
    File "scripts/train_mobile.py", line 75, in train
    model = torch.nn.DataParallel(model, device_ids=[0, 1]).cuda()
    File "/opt/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 230, in cuda
    return self._apply(lambda t: t.cuda(device))
    File "/opt/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 152, in _apply
    module._apply(fn)
    File "/opt/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 152, in _apply
    module._apply(fn)
    File "/opt/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 152, in _apply
    module._apply(fn)
    File "/opt/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 158, in _apply
    param.data = fn(param.data)
    File "/opt/miniconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 230, in
    return self._apply(lambda t: t.cuda(device))
    RuntimeError: cuda runtime error (38) : no CUDA-capable device is detected at /home/kenzhang/pytorch/aten/src/THC/THCGeneral.cpp:70

mobilenetv2exfuse problem

in LightNet-master\models\mobilenetv2exfuse.py

line 184: if self.traval == "train" and self.n_class != 0:
line 208: elif self.traval == "train" and self.n_class != 0:

why a repetition?
Thanks for reply!

Hei

sofa, nice job

NoMoudle named encoding

Hello Authors,

I am encountering this issue, and am not able to solve this.

Traceback (most recent call last): File "scripts/train_mobile_scannet.py", line 22, in <module> from models.rfmobilenetv2plus import RFMobileNetV2Plus File "/nfs/home/us000146/LightNet/models/rfmobilenetv2plus.py", line 6, in <module> from modules import SCSEBlock, InPlaceABN, InPlaceABNWrapper, RFBlock File "/nfs/home/us000146/LightNet/modules/__init__.py", line 4, in <module> from . context_encode import ContextEncodeInplaceABN, ContextEncodeDropInplaceABN File "/nfs/home/us000146/LightNet/modules/context_encode.py", line 4, in <module> import encoding ModuleNotFoundError: No module named 'encoding'

I am running under the following configuration:

Python 3.6.13
GCC 7.3.0 [on linux]
Torch 0.4.1.post2

I have tried a few things but nothing works out and I am stuck here, without being able to train the model. Please suggest what should I do?

Regards,
Nitin Bansal

Mapillary vistas dataset

I want to use the vistas dataset for semantic segmentation training, but the official provide labelids images with only instance segmentation, and no labelids images with semantic segmentation. What should I do?

How to train with my own dataset?

Hello, I wonder if I can use my own dataset to train on these networks? And is there any limitation about the objects' classes? For example, some housewares. If the segmentation task on them can be done, could you please tell me the pipeline? I have no idea how to organize my data into a proper form to fit in the code. Thanks a lot!

how about SE-WResNetV2?

hi,I have trained SE-WResNetV2 about 100 epochs, i get mIOU=0.756, it is far away from 0.8013 mIOU which you've get and share, en , i want to known there is some tricks about train SE-WResNetV2? And how to get the same mIOU with you?

Question about the pretrained RFMobilenetV2Plus model.

Excuse me but, I'd like to ask about the RFMobilenetV2Plus pretrained model. When will you upload those pretrained model (either pretrained on imagenet or cityscape)?
I didnt's find any clue in your README.md
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.