flyinghu123 / CPR

The implement for paper : "Target before Shooting: Accurate Anomaly Detection and Localization under One Millisecond via Cascade Patch Retrieval"
https://arxiv.org/abs/2308.06748v1
MIT License
79 stars 7 forks source link

bash train.sh #12

Closed zhongxiaj closed 2 weeks ago

zhongxiaj commented 2 weeks ago

I 'm just training mvtec dataset with command :bash train.sh while an errror occur : dataloader = DataLoader(dataset, batch_size=args.batch_size, sampler=InfiniteSampler(dataset), num_workers=args.num_workers, pin_memory=True, worker_init_fn=seed_worker) File "/home/kexin/anaconda3/envs/py310/lib/python3.10/site-packages/torch/utils/data/sampler.py", line 140, in init raise ValueError(f"num_samples should be a positive integer value, but got num_samples={self.num_samples}") ValueError: num_samples should be a positive integer value, but got num_samples=0

I just change mvtec dataset from: './data' ---> 'my_own_mvtec_dataset_path'

Other commands can be executed normally

zhongxiaj commented 2 weeks ago

it 's weird that :python tools/generate_synthetic_data.py -fd log/foreground_mvtec_DenseNet_features.denseblock1_320
in the /log/synthetic_mvtec_640_12000_True_jpg/bottle/train.txt is None ,and all the txt in synthetic_mvtec_640_12000_True_jpg is None

flyinghu123 commented 2 weeks ago

You need to change “https://github.com/flyinghu123/CPR/blob/dd20b547b7bb9ccffefc61d8bf0030e695a8672c/tools/generate_synthetic_data. py#L139” and ”https://github.com/flyinghu123/CPR/blob/dd20b547b7bb9ccffefc61d8bf0030e695a8672c/tools/generate _synthetic_data.py#L108”, it is not recommended to change the data to a custom path, as there are many places in the code that use the fixed ”. /data”

zhongxiaj commented 2 weeks ago

You need to change “https://github.com/flyinghu123/CPR/blob/dd20b547b7bb9ccffefc61d8bf0030e695a8672c/tools/generate_synthetic_data. py#L139” and ”https://github.com/flyinghu123/CPR/blob/dd20b547b7bb9ccffefc61d8bf0030e695a8672c/tools/generate _synthetic_data.py#L108”, it is not recommended to change the data to a custom path, as there are many places in the code that use the fixed ”. /data”

yeah,I also found it, Thanks a lot