Git Product home page Git Product logo

lightweight-segmentation's Introduction

Hi, I'm Tramac 👋

A programmer from China, currently working on CV research at Baidu.

github follow Email HF 知乎

Tramac's github stats

lightweight-segmentation's People

Contributors

tramac 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

lightweight-segmentation's Issues

data preprocessing

thanks for your excellent work!

why must the data be crop into squares(768*768), and the original aspect ratio cannot be maintained?.

mobileNet_0.25

Hi:
Do you have plans to implement mobileNet_0.25?
Thanks

to onnx

to_onnx->onnx_to_trt
Unsupported: ONNX export of operator adaptive_avg_pool2d, since output size is not factor of input size

mobilenetv3 backbone

Thanks for your excellent work !

I print the shapes of c2 and c4 from here, [1, 112, 64, 128] and [1, 960, 64, 128] respectively.
image

As shown above, c2 should be 1/8 of the input, shape should be [1, 40, 128, 256]. c4 should be 1/16 of the input picture, and shape should be [1, 160, 64, 128]

In addition, layer3_setting and layer4_setting are inconsistent with those in the paper:
image

Is my understanding wrong? hope for help

TypeError: object of type 'COCOSegmentation' has no len()

I have added mscoco.py from the project that you did suggest.

I guess the problem below arises because of the incompatibility between python's version and pycocotools. Is there any suggestion to modify the code? thanks in advance.

train set
loading annotations into memory...
Done (t=0.89s)
creating index...
index created!
Traceback (most recent call last):
File "train.py", line 291, in
trainer = Trainer(args)
File "train.py", line 106, in init
args.iters_per_epoch = len(trainset) // (args.num_gpus * args.batch_size)
TypeError: object of type 'COCOSegmentation' has no len()

lr_scheduler error while training

Hi,
I am using PyTorch version '1.4.0.dev20191118' and I am trying to train mobilenet v3 large.
I am getting this error related to the lr_scheduler:

Traceback (most recent call last):
File "C:/CP/DL_REPOSITORIES/Lightweight-Segmentation/scripts/train.py", line 291, in
trainer = Trainer(args)
File "C:/CP/DL_REPOSITORIES/Lightweight-Segmentation/scripts/train.py", line 157, in init
warmup_method=args.warmup_method)
File "C:\CP\DL_REPOSITORIES\Lightweight-Segmentation\light\utils\lr_scheduler.py", line 154, in init
super(WarmupPolyLR, self).init(optimizer, last_epoch)
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\optim\lr_scheduler.py", line 77, in init
self.step()
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\optim\lr_scheduler.py", line 150, in step
for param_group, lr in zip(self.optimizer.param_groups, values):
UnboundLocalError: local variable 'values' referenced before assignment

Should I downgrade my PyTorch version if I want the training to work or will you support latter PyTorch versions?

Thanks.

Shortcut in MobileNetV3 segmentation head

Acoording to Searching for MobileNetV3, there is a connection from feature 1/8 to the end of the segmentation head. Is it implemented? I did not find a shortcut.
image

About mobilenetv3seg output and form of ground truth

I am trying to train my own dataset with two classes ( background and foreground ). I get confused of the output from seg net:

class MobileNetV3Seg(BaseModel):
    def __init__(self, nclass, aux=False, backbone='mobilenetv3_small', pretrained_base=False, **kwargs):
        super(MobileNetV3Seg, self).__init__(nclass, aux, backbone, pretrained_base, **kwargs)
        mode = backbone.split('_')[-1]
        self.head = _Head(nclass, mode, **kwargs)
        if aux:
            inter_channels = 40 if mode == 'large' else 24
            self.auxlayer = nn.Conv2d(inter_channels, nclass, 1)

    def forward(self, x):
        size = x.size()[2:]
        _, c2, _, c4 = self.base_forward(x)
        outputs = list()
        x = self.head(c4)
        x = F.interpolate(x, size, mode='bilinear', align_corners=True)
        outputs.append(x)  # Why output is a list which only append one elemenet?

        if self.aux:  # What's the aux for?
            auxout = self.auxlayer(c2)
            auxout = F.interpolate(auxout, size, mode='bilinear', align_corners=True)
            outputs.append(auxout)
        return tuple(outputs)

Furthermore I wonder the form of segmentation ground truth. My dataset comes with ground truth of dimension (Height, Width, 1) and last aixs sets 0 for background and 1 for foreground. But as my observation of your code the ground truth of cityscapes seems split into NUMCLASS ( 19 for cityscapes ) channels, something like (Height, Width, NUMCLASS ). So I wonder how to adapt the segmentation ground truth of my dataset to such kind of form.

Instance sematic segmentation

@Tramac thanks for the wonderful code base , i have few following queries

  1. Can we use the architectures like efficient net , shuffle net for instance segmentation
  2. How much work around will it be there if we have to use the following for instance segmentation

Some questions concerning MobileNetV3+LR-ASPP

Hi, Tramac!

Your repo is really helpful to do some interesting experiments : )
I'm new in semantic segmentation, and I have some questions w.r.t. training of MobileNetV3+LR-ASPP.
Could you please tell how to use 768x768 resolution to train LR-ASPP framework ? (There is AvgPool (49, 49) with stride [16, 20], 768x768 input will get error).

BTW, my WeChat Id is: UsedToBe97. Maybe we can talk through it more smoothly.

我想知道验证的时候如何获取对应的图片名称?我一直获取不到

    for i, (image, target) in enumerate(self.val_loader):
        image = image.to(self.device)
        target = target.to(self.device)

        with torch.no_grad():
            outputs = model(image)
        self.metric.update(outputs[0], target)
        pixAcc, mIoU = self.metric.get()
        logger.info("Sample: {:d}, validation pixAcc: {:.3f}, mIoU: {:.3f}".format(
            i + 1, pixAcc * 100, mIoU * 100))

        if self.args.save_pred:
            pred = torch.argmax(outputs[0], 1)
            pred = pred.cpu().data.numpy()

            predict = pred.squeeze(0)
            mask = get_color_pallete(predict, self.args.dataset)
            mask.save(os.path.join(outdir,  str(i) + '.png'))
    synchronize()

就这一段代码里面,原来for循环里面不是有一个filename的吗?然后他总是报错。后来我就迫不得已把他删掉, mask.save(os.path.join(outdir, str(i) + '.png'))改成用i循环命名的方法?有什么办法可以解决吗?求助了!

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.