lewandofskee/DiAD

在执行python finetune_autoencoder.py命令时报错,checkpoints文件夹为空

Closed this issue · 7 comments

在执行python finetune_autoencoder.py命令时报错,checkpoints文件夹为空。

finetune_autoencoder.py中的data_path = './data/mvtecad/'是不是要在根目录下再创建一个文件夹data/mvtecad/,那么在mvtecad文件夹下图片是如何存放的(目录是什么)
微信图片_20240102203440

Possibly you need to download the kl-f8.zip for the checkpoint. And you should create a path 'data/mvtecad/' where the directory is the same as the original MVTec-AD setting. Or you could change your dataset path in the finetune_autoencoder.py file. Or you could download our Pretrained Model.

|-- root
    |-- data
        |-- mvtecad
            |-- bottle
                |-- ground_truth
                    |-- broken_large
                        |-- 000_mask.png
                    |-- broken_small
                        |-- 000_mask.png
                    |-- contamination
                        |-- 000_mask.png
                |-- test
                    |-- broken_large
                        |-- 000.png
                    |-- broken_small
                        |-- 000.png
                    |-- contamination
                        |-- 000.png
                    |-- good
                        |-- 000.png
                |-- train
                    |-- good
                        |-- 000.png
        |-- train.json
        |-- test.json

您好,根据您上述的解决方法做出改进后在执行python finetune_autoencoder.py命令时仍然报出相同的错误,之后我采用你们的预训练模型继续进行实验,在执行python build_model.py指令后可以正常生成diad.ckpt权重文件,但在执行python train.py时发生报错:
image

It seems that your network cannot download the pretrained resnet50 model from timm, where in File "/root/DiAD-main/ldm/models/diffusion/ddpm.py", line 484, in on_validation_epoch_start
pretrained_model = timm.create_model("resnet50", pretrained=True, features_only=True).
One solution is that you could download the pretrained model first and put it in your path and revise the code:
pretrained_model = timm.create_model("resnet50", pretrained=False, checkpoint_path=your_path, features_only=True).

从 timm 下载预训练 resnet50 模型,并修改路径如下代码:
pretrained_model = timm.create_model("resnet50", pretrained=False, checkpoint_path='/root/autodl-tmp/models/resnet50_a1_0-14fe96d1.pth', features_only=True),运行python train.py时报错:
image

try: pretrained_model = timm.create_model("resnet50", pretrained=False, checkpoint_path='/root/autodl-tmp/models/resnet50_a1_0-14fe96d1.pth', strict=False, features_only=True)

修改为pretrained_model = timm.create_model("resnet50", pretrained=False, checkpoint_path='/root/autodl-tmp/models/resnet50_a1_0-14fe96d1.pth', strict=False, features_only=True)运行python train.py时报错:
image

Or you could try to keep the original code and move the rresnet50_a1_0-14fe96d1.pth pretrained model to the path: "....../.cache/torch/hub/checkpoints"