Coder Social home page Coder Social logo

royalvane / clan Goto Github PK

View Code? Open in Web Editor NEW
291.0 291.0 46.0 33.74 MB

( TPAMI2022 / CVPR2019 Oral ) Taking A Closer Look at Domain Shift: Category-level Adversaries for Semantics Consistent Domain Adaptation

License: MIT License

Python 100.00%
adversarial-learning domain-adaptation semantic-segmentation transfer-learning

clan's People

Contributors

royalvane 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

clan's Issues

About the training process

When I train from GTA5 to Cityscapes, the loss of Discriminator is oscillating all the time. Is this normal? Or how to alleviate it?

Cluster center distance

it seems that CCD part is not in your codes. would you please provide codes of calculating CCD? thank you so very much!

how to use multi gpu

i have two gpu 1080ti
i want to multi gpu because 1 gpu has out of memory
so i use function" nn.dataparallel (model)"
but my gpu don't allocate 2gpu and allocate only one gpu
(print(torch.cuda.device_count()) is 2 but don't allocate them)
do you know how to solve this problem?

About t-sne

"As a result, the original well-segmented class are well preserved. We then map the high-dimensional features of (b), (c) and (d) to a 2-D space with t-SNE [28] shown in (e), (f) and (g)"
This is the description in your paper, I want to know which layer of output this high-dimensional features refers to,thanks~

About Warm-Up Schedule

Hi, congratulations on the work! I noticed that you use a warm-up learning rate schedule where the learning rate grows up to base learning rate util 50000 iteration. Could you share any advantages about this settting? Thanks.

Dataloader is always reported as wrong.

Hi!
I am trying to reproduce your experiments, however, I always broke in line.309 of CLAN_train.py file.
_, batch = next(trainloader_iter)
Every time my device reports wrong when meeting this sentence.

Reported:
'RuntimeError: DataLoader worker (pid(s) 15186) exited unexpectedly'

My environment is: Python 3.6.8, torch 1.1.0.
Could you please let me know how can I do to solve the issue since I really apparate this idea reported in this paper.

About training speed

I found when train Deeplab from Imagenet pretrained weight, loss drop fast.
But when train FCN8s, loss drop extremely slow.
Did you get the same pattern?

About data loading

Hello, thank for sharing the great work. I have a quick question. When I train the CLAN model, I find that randomly mirror the images and randomly scale the crop_size are used fo r preprocessing data, which is a little different from previous works.

When training, I can think of it as data augmentation. But, why apply the above preprocessing to the test phase?

Thanks!

About WeightedBCEWithLogitLoss

Hi, I have a problem in understanding your code of class WeightedBCEWithLogitLoss, showed as follow. It seems the input is logits, but there isn't any sigmoid or softmax operation done on it. And I'm confused of that two lines. Is the loss computation same as pytorch BCEWithLogitLoss???
image

About Significance-aware Information Bottleneck Code

@RoyalVane Dear authors,

Thanks for sharing this impressive work!
I was wondering if you have public code for reproducing CLAN-IB, CLAN-SIB, and CLAN-Full models, as presented in your TPAMI paper, Category-Level Adversarial Adaptation for Semantic Segmentation using Purified Features.

Thanks so much!

Num Classes=19 for SYNTHIA dataset?

Congratulations to you on this oral paper.
I have a quick glance at your codes, and did you train your model with 19 classes over SYNTHIA dataset?

CUDA error: out of memory

Hi, I trained the model on a 1080Ti, but get CUDA out of memory error.

python  CLAN_train.py --snapshot-dir ./snapshots/GTA2Cityscapes
....
Traceback (most recent call last):
  File "CLAN_train.py", line 426, in <module>
    main()
  File "CLAN_train.py", line 319, in main
    loss_seg = (loss_calc(pred_source1, labels_s, args.gpu) + loss_calc(pred_source2, labels_s, args.gpu))
  File "CLAN_train.py", line 165, in loss_calc
    return criterion(pred, label)
  File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in __call__
    result = self.forward(*input, **kwargs)
  File "/media/ubuntu/76c3afb9-9877-4540-ac95-6a70ac97a8fc/PycharmProjects/UDASS/CLAN/utils/loss.py", line 72, in forward
    predict = P[target_mask.view(N, 1, H, W).repeat(1, C, 1, 1)].view(C, -1)
RuntimeError: CUDA error: out of memory

The sizes of GTA5 images and Cityscapes images are set as default in the code.
So 11G memory is not enough?

运行问题

我的运行环境是 pytorch 1.1 python3.6 当
最开始执行时 显示错误为:
/home/ygl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/upsampling.py:129: UserWarning: nn.Upsample is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.{} is deprecated. Use nn.functional.interpolate instead.".format(self.name))
Fatal Python error: Cannot recover from stack overflow.
...
Traceback (most recent call last):
File "CLAN_train.py", line 440, in
main()
File "CLAN_train.py", line 334, in main
loss_seg.backward()
File "/home/ygl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/tensor.py", line 102, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/ygl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/ygl/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 274, in handler
_error_if_any_worker_fails()

About the batch size

Hi, first congratulations on your excellent work. The only thing that I want to ask is whether the batch size is one? Did you try to use a relatively large batch size??

The evaluation results on GTA2cityscapes

Hi, I trained your code on GTA52cityscapes following your instruction but failed to reproduce the evaluation results shown in your paper. The mIoU is close to the TAN baseline but worse than your method. The below is what I got. Any suggestions? Thanks!===>road: 84.44
===>sidewalk: 25.92
===>building: 78.1
===>wall: 21.57
===>fence: 24.06
===>pole: 26.74
===>light: 30.62
===>sign: 19.42
===>vegetation: 83.48
===>terrain: 31.98
===>sky: 73.76
===>person: 58.13
===>rider: 25.26
===>car: 70.47
===>truck: 35.57
===>bus: 43.26
===>train: 0.82
===>motocycle: 27.86
===>bicycle: 22.75
===> mIoU: 41.27

About the damping policy

Thanks for your codes! I have doubt about the damping policy you used to replace the early stopping. I also think training 150k as AdaptSeg did is too time-consuming and shortening the total iteration steps is necessary.
The damping weight of adversarial loss in GRL is ascending from 0 to 1 with the iteration increasing. While you set the actually opposite policy where the weight descending from 1 to 0 along with the iterating. So could you share some insights to use such a damping policy?
Thanks!

how to split the deeplab-resnet model to multiple opus

Hi,
I have 2 gpus with 8G for each, I tried to allocate some layers to gpu 0 and the others to gpu1. But got the following errors. I don't see weights initialization for Bottleneck module. Could you please tell me how to assign the weights to a certain gpu for Bottlenecl? Thanks!

File "CLAN_train.py", line 312, in main
pred_source1, pred_source2 = model(images_s)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/media/hw/ychen245/ying-projects/fall2019_research/week2/CLAN-master/model/CLAN_G.py", line 182, in forward
x = self.layer3(x.to(1))
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/media/hw/ychen245/ying-projects/fall2019_research/week2/CLAN-master/model/CLAN_G.py", line 89, in forward
out = self.conv1(x)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 343, in forward
return self.conv2d_forward(input, self.weight)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 340, in conv2d_forward
self.padding, self.dilation, self.groups)
RuntimeError: Expected tensor for argument #1 'input' to have the same device as tensor for argument #2 'weight'; but device 1 does not equal 0 (while checking arguments for cudnn_convolution)

About source only and t-nse

source only-Resnet is 36.6 in many papers, but I didn't get 36.6 in my trial. Can you share your training model with me?
Another question ,is the t-nse_fearture's shape like [h * w, 2048], and the label's shape like [h * w]? [ps: you saide you use layer4 features as input in another issues.]
In my process, i get the layer4 features which shape is [1,2048,81,61], and then i upsample the features to [1, 2048, 1024, 512] which match the labels shape[1024, 512], and then i reshape the features to [1024 * 512, 2048] and labels to [1024 * 512].
Is that right?

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.