davide-coccomini / Combining-EfficientNet-and-Vision-Transformers-for-Video-Deepfake-Detection

Code for Video Deepfake Detection model from "Combining EfficientNet and Vision Transformers for Video Deepfake Detection" presented at ICIAP 2021.
https://dl.acm.org/doi/abs/10.1007/978-3-031-06433-3_19
MIT License
239 stars 60 forks source link

AttributeError: 'EfficientNet' object has no attribute 'delete_blocks' #49

Open JEILDLWLRMA opened 1 year ago

JEILDLWLRMA commented 1 year ago

Loaded pretrained weights for efficientnet-b0

AttributeError Traceback (most recent call last) Cell In[19], line 1 ----> 1 model = CrossEfficientViT(config=config) 2 model.eval()

Cell In[14], line 267, in CrossEfficientViT.init(self, config) 262 dropout = config['model']['dropout'] 263 emb_dropout = config['model']['emb-dropout'] --> 267 self.sm_image_embedder = ImageEmbedder(dim = sm_dim, image_size = image_size, patch_size = sm_patch_size, dropout = emb_dropout, efficient_block = 16, channels=sm_channels) 268 self.lg_image_embedder = ImageEmbedder(dim = lg_dim, image_size = image_size, patch_size = lg_patch_size, dropout = emb_dropout, efficient_block = 1, channels=lg_channels) 270 self.multi_scale_encoder = MultiScaleEncoder( 271 depth = depth, 272 sm_dim = sm_dim, (...) 289 dropout = dropout 290 )

Cell In[14], line 186, in ImageEmbedder.init(self, dim, image_size, patch_size, dropout, efficient_block, channels) 184 assert image_size % patch_size == 0, 'Image dimensions must be divisible by the patch size.' 185 self.efficient_net = EfficientNet.from_pretrained('efficientnet-b0') --> 186 self.efficient_net.delete_blocks(efficient_block) 187 self.efficient_block = efficient_block 189 for index, (name, param) in enumerate(self.efficient_net.named_parameters()):

File ~/.local/lib/python3.10/site-packages/torch/nn/modules/module.py:1614, in Module.getattr(self, name) 1612 if name in modules: 1613 return modules[name] -> 1614 raise AttributeError("'{}' object has no attribute '{}'".format( 1615 type(self).name, name))

AttributeError: 'EfficientNet' object has no attribute 'delete_blocks'

davide-coccomini commented 11 months ago

Can you check inside the folder cross-efficient-vit/efficient_net/efficientnet_pytorch/model.py if you have the delete_blocks method?