Reputation: 1
I'm trying to use a pre-trained CRAFT model for reading invoices. After cloning the repository from https://github.com/clovaai/CRAFT-pytorch.git (on colab) and uploading the weights (craft_mlt_25k.pth), I made the following modification:
Commented out lines 7 and 25 in vgg16_bn.py (these lines refer to model_urls).
When running the command:
!python test.py --trained_model=/content/CRAFT-pytorch/craft_mlt_25k.pth
--test_folder=/content/412713_07_08_2024_09_21.gif
I get some warnings, but no errors. However, the result folder is empty, and I am not sure why. this is the output of running the test.py
/usr/local/lib/python3.10/dist-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
warnings.warn(
/usr/local/lib/python3.10/dist-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or None
for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=None
.
warnings.warn(msg)
1
Loading weights from checkpoint (/content/CRAFT-pytorch/craft_mlt_25k.pth)
/content/CRAFT-pytorch/test.py:128: FutureWarning: You are using torch.load
with weights_only=False
(the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only
will be flipped to True
. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals
. We recommend you start setting weights_only=True
for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
net.load_state_dict(copyStateDict(torch.load(args.trained_model)))
elapsed time : 3.337860107421875e-06s
Any insights or troubleshooting tips would be greatly appreciated!
Additionally, I have a question regarding text segmentation: Is it possible to segment specific text parts, like "Bill to," by lowering the link_threshold parameter? If not, what alternative approaches would you recommend?
Thanks in advance for your help!
I tried running the pre-trained CRAFT model by cloning the repository and uploading the craft_mlt_25k.pth
weights. I modified the vgg16_bn.py
file by commenting out the lines referencing model_urls
to bypass an import error. I expected the code to process the image and save the results in the result
folder. While the script ran without errors (only showing warnings), the result
folder remained empty, and no output images were generated.
Upvotes: 0
Views: 98