Are config files required for efficientdet models ?
#1
by
Manish1903
- opened
I am trying to load the model in a controlled environment (firewall blocked) by downloading the model weights manually from this repository.
import layoutparser as lp
model = lp.AutoLayoutModel(config_path = "models/PubLayNet/tf_efficientdet_d1/publaynet-tf_efficientdet_d1.pth.tar")
gives "ValueError: Invalid model config_path. Please suggest how to resolve this."
Thanks
I believe it should be
import layoutparser as lp
model = lp.models.effdet.layoutmodel.EfficientDetLayoutModel('tf_efficientdet_d1', model_path='path_to_model_file', label_map={0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"})
There also seems to be a weird bug with either the layoutparser
package or the effdet
package where the head doesn't reset when loading the model, resulting in the following error
size mismatch for class_net.predict.conv_pw.weight: copying a param with shape torch.Size([810, 88, 1, 1]) from checkpoint, the shape in current model is torch.Size([45, 88, 1, 1]).
This stems from the effdet
library not resetting the head before loading the pretrained model. You can fix this in your effdet
library by editing the factory.py
file.