-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use It as a backbone for different purposes ? #246
Comments
I met the same problem, have you solved it? |
I have used different network instead of this but there were some way that let the model work in terms of giving right output shape. You can try something like that : backbone = EfficientNet.from_pretrained('efficientnet-b2',include_top = False) backbone_t = nn.Sequential(*[a,b,cx]) Here I have used b2. But the number of children might change in different versions, so you should care it. And check a,b,c maybe the children of d if there is more main children you need in the different version. |
Hi, I have been trying your approach this seems to work but I have few doubts I would like to clarify when porting this as a backbone, is it possible to contact you @ertugrulsmz in any way. Would really appreciate since I am a beginner for datascience |
Hey, @avishka40 |
I would use I'm trying to build a segmentation branch on top of a middle layer using |
i got the same problem, here is my code , you can try and see the result: ` if you want to get the shape of last convolution : ` #input_shape = (1 ,3 ,112,112) x = toch.rand(input_shape) backbone = EfficientNet.from_name('efficientnet-b7') y = backbone.extract_features(x) print(y.shape) `` |
I had the same problem, and using For anyone else that has my problem, you can use my edited version fork that by setting |
I would like to use efficientnet as a backbone for object detection. However non of my attempts yield results.
What do you suggest ? (In resnet implementation this code snippet works ...)
from efficientnet_pytorch import EfficientNet
model = EfficientNet.from_pretrained('efficientnet-b6')
modules=list(model.children())[:-2] #remove last 2 layers only need feature extractor
modelbackbone =nn.Sequential(*modules)
img = torch.Tensor(3, 299, 299).normal_() # random image
img = torch.unsqueeze(img, 0) # Add dimension 0 to tensor
img_var = Variable(img) # assign it to a variable
features_var = modelbackbone(img_var)
ERROR : forward() takes 1 positional argument but 2 were given
The text was updated successfully, but these errors were encountered: