d-li14 / dgconv.pytorch

PyTorch implementation of Dynamic Grouping Convolution and Groupable ConvNet with pre-trained G-ResNeXt models

Home Page:https://arxiv.org/abs/1908.05867

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can you provide the training code?

GuideWsp opened this issue · comments

can you provide the training code?

I am also confused about code training. Could you tell me how to optimize parameter U in code ? If you can provide one little demo about this,I will be very grateful. @d-li14

I am also confused about code training. Could you tell me how to optimize parameter U in code ? If you can provide one little demo about this,I will be very grateful. @d-li14
I have train the model!

I am also confused about code training. Could you tell me how to optimize parameter U in code ? If you can provide one little demo about this,I will be very grateful. @d-li14
I have train the model!

Hi, did you train the model?

I am also confused about code training. Could you tell me how to optimize parameter U in code ? If you can provide one little demo about this,I will be very grateful. @d-li14
I have train the model!

Hi, did you train the model?

Yes, i have implemented the training processing in my github repo. https://github.com/longxianlei/G-ResNeXt_GroupNet/blob/e302de45ae8ba9f89484b01e590d38bc7ef882a2/dgconv.py#L58

https://github.com/longxianlei/G-ResNeXt_GroupNet/blob/e302de45ae8ba9f89484b01e590d38bc7ef882a2/train.py#L243

https://github.com/longxianlei/G-ResNeXt_GroupNet

The skeleton code should be like this:

def get_constraint(model):
	count = 0
	for name, param in model.named_parameters():
		if 'C_gate' in name:
			count += 2**(len(param)*2)
	return count / b # b denotes a scale of complexity of the GConv layers in the entire network

...

def train(args):
	...
	output, regularizer = model(input)
	constraint = get_constraint(model)
	a = -0.02 if regularizer > constraint else 0
	loss = criterion(output, target) * torch.pow(constraint / regularizer, a)
	...

@GuideWsp has sent an e-mail to ask for the code, so I closed this issue before.