mancinimassimiliano / cumix Goto Github PK
View Code? Open in Web Editor NEWOfficial code for "Towards Recognizing Unseen Categories in Unseen Domains"
License: MIT License
Official code for "Towards Recognizing Unseen Categories in Unseen Domains"
License: MIT License
I want to do the experiments with different datasets? How can I get the attributes file?(.npy file)
Thanks
Hello, I think there exsists a logical error in your code.
In methods.py
, the class method get_sample_mixup()
of the class CuMix
is not consistant with the mixup rules your proposed in paper.
Here I take out the error line 246
indeces = ratio_within_dom * permuted_within_dom + (1. - ratio_within_dom) * permuted_across_dom
In your code, you mixup the index instead of content (image or feature) or label, then the mixup index are employed to extract content from current batch.
This is not reasonable and not consistant with Eq. (5)
in your paper.
Hope you can check the code. Thanks
Hi @mancinimassimiliano, I'm very glad to see your good work CuMix. I can understand the `train classifier' is being trained by methods.py#L309. However, I can not find any clue how the final classifier in your case is being trained. Can you please provide some help?
Hi! Why do synthesized labels(mixup_labels) have decimals?
I wanted to use it as a data enhancement to add to the method, but found that mixup_labels is not an integer.
When I put training set labels and mixup_labels cat after cross entropy float type error
How do I turn mixup_labels into integers?
I'm trying to reproduce your results on ZSL+DG. When I trained the model on one RTX 2080Ti even one Titan V100, it ran out of memory. Could you please tell more about the compute for your ZSL+DG experiments? It would be great if you can give an estimated training time.
Thanks so much.
Herewidth I've attached the error info:
configs/zsl+dg/painting.json
Target: painting run 1/10
Traceback (most recent call last):
File "main.py", line 143, in
method = CuMix(seen_classes=seen,unseen_classes=unseen,attributes=attributes,configs=configs,zsl_only = not args.dg,
File "/ibex/scratch/yik/CIZSL-JournalVersion/CuMix/methods.py", line 83, in init
self.backbone.to(device)
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/site-packages/torch/nn/modules/module.py", line 443, in to
return self._apply(convert)
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/site-packages/torch/nn/modules/module.py", line 203, in _apply
module._apply(fn)
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/site-packages/torch/nn/modules/module.py", line 225, in _apply
param_applied = fn(param)
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/site-packages/torch/nn/modules/module.py", line 441, in convert
return t.to(device, dtype if t.is_floating_point() else None, non_blocking)
RuntimeError: CUDA error: out of memory
Traceback (most recent call last):
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/site-packages/torch/distributed/launch.py", line 263, in
main()
File "/home/yik/anaconda2/envs/cumix/lib/python3.8/site-packages/torch/distributed/launch.py", line 258, in main
raise subprocess.CalledProcessError(returncode=process.returncode,
subprocess.CalledProcessError: Command '['/home/yik/anaconda2/envs/cumix/bin/python', '-u', 'main.py', '--local_rank=0', '--zsl', '--dg', '--target', 'painting', '--config_file', 'configs/zsl+dg/painting.json', '--data_root', '/xxx/CuMix/data/DomainNet', '--name', 'painting_exps_zsldg']' returned non-zero exit status 1.
Below is the get_sample_mixup function on L237 in methods.py:
def get_sample_mixup(self, domains):
# Check how many domains are in each batch (if 1 skip, but we have 1 just in ZSL only exps)
if self.dpb>1:
doms = list(range(len(torch.unique(domains))))
bs = domains.size(0) // len(doms)
selected = derange(doms)
permuted_across_dom = torch.cat([(torch.randperm(bs) + selected[i] * bs) for i in range(len(doms))])
permuted_within_dom = torch.cat([(torch.randperm(bs) + i * bs) for i in range(len(doms))])
ratio_within_dom = torch.from_numpy(RG.binomial(1, self.mixup_domain, size=domains.size(0)))
indeces = ratio_within_dom * permuted_within_dom + (1. - ratio_within_dom) * permuted_across_dom
else:
indeces = torch.randperm(domains.size(0))
return indeces.long()
As I understand for domains per batch > 1, depending on ratio_within_dom (1 or 0) this function returns indices for mixup either within or across domains. However, I can't understand how the 2 tensors permuted_across_dom and permuted_within_dom ensure that the batch indices are properly re-arranged to achieve this. I have tried with some dummy inputs, but couldn't figure out the exact logic. Would like to hear your thoughts on this.
G Drive folder is private. Please make it accessible for anyone
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.