Comments (5)
Like you, I also made an error in the test after the training, but the channel of my args is 3. The problem I encountered during the test is that args["img_size"] is of float type, resulting in the following error.
Since image dtype is floating point, you must specify '
'the data_range parameter. Please read the documentation '
'carefully (including the note). It is recommended that '
'you always specify the data_range anyway.
The outermost layer of the faulting method stack is the following line of code
Line 243 in 3052f04
Line 48 in 3052f04
My training args are as follows
{
"img_size": [
256,
256
],
"Batch_Size": 1,
"EPOCHS": 3000,
"T": 1000,
"base_channels": 128,
"beta_schedule": "linear",
"channel_mults": "",
"loss-type": "l2",
"loss_weight": "none",
"train_start": true,
"lr": 1e-4,
"random_slice": true,
"sample_distance": 800,
"weight_decay": 0.0,
"save_imgs": true,
"save_vids": false,
"dropout": 0,
"attention_resolutions": "16,8",
"num_heads": 2,
"num_head_channels": -1,
"noise_fn": "simplex",
"channels": 3,
"dataset": "leather"
}
from anoddpm.
Like you, I also made an error in the test after the training, but the channel of my args is 3. The problem I encountered during the test is that args["img_size"] is of float type, resulting in the following error.
Since image dtype is floating point, you must specify '
'the data_range parameter. Please read the documentation '
'carefully (including the note). It is recommended that '
'you always specify the data_range anyway.The outermost layer of the faulting method stack is the following line of code
Line 243 in 3052f04
Line 48 in 3052f04
My training args are as follows
{ "img_size": [ 256, 256 ], "Batch_Size": 1, "EPOCHS": 3000, "T": 1000, "base_channels": 128, "beta_schedule": "linear", "channel_mults": "", "loss-type": "l2", "loss_weight": "none", "train_start": true, "lr": 1e-4, "random_slice": true, "sample_distance": 800, "weight_decay": 0.0, "save_imgs": true, "save_vids": false, "dropout": 0, "attention_resolutions": "16,8", "num_heads": 2, "num_head_channels": -1, "noise_fn": "simplex", "channels": 3, "dataset": "leather" }
The most likely answer here is that the code just needs a check if 3 channels are given with an edge case (there could be a nicer way but I'm not super familiar off the top of my head with the SSIM method from sklearn) - When writing my original codebase I naïvely hard coded the channels in some areas leading to issues above.
from anoddpm.
Hello author, I am honored to read your paper. After completing leather data set training, I tried to detect, but encountered some problems: Here is my args file:
args19.json { "img_size": [256,256], "Batch_Size": 1, "EPOCHS": 1000, "T": 1000, "base_channels": 128, "beta_schedule": "linear", "channel_mults": "", "loss-type": "l2", "loss_weight": "none", "train_start": true, "lr": 1e-4, "random_slice": true, "sample_distance": 600, "weight_decay": 0.0, "save_imgs":true, "save_vids":true, "dropout":0, "attention_resolutions":"16,8", "num_heads":2, "num_head_channels":-1, "noise_fn":"simplex", "dataset":"leather", "channels": 1 }
After the training:
- Error is reported in evaluation.testing() immediately after train:
File "diffusion_training.py", line 153, in train evaluation.testing(testing_dataset_loader, diffusion, ema=ema, args=args, model=model) File "/home/dell/local/HK/AnoDDPM-master/evaluation.py", line 124, in testing x = x.to(device) NameError: name 'device' is not defined
- When I tried detection, I entered the following command:
python3 detection.py args19.json
Here, args19.json is the configuration file I trained with
But the following error is reported:This is the shape of the layer for the row where the error occurred Conv2d(1, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)
Traceback (most recent call last): File "detection.py", line 959, in anomalous_metric_calculation() File "detection.py", line 226, in anomalous_metric_calculation t_distance=200, denoise_fn=args["noise_fn"] File "/home/dell/local/HK/AnoDDPM-master/GaussianDiffusion.py", line 354, in forward_backward out = self.sample_p(model, x, t_batch, denoise_fn) File "/home/dell/local/HK/AnoDDPM-master/GaussianDiffusion.py", line 299, in sample_p out = self.p_mean_variance(model, x_t, t) File "/home/dell/local/HK/AnoDDPM-master/GaussianDiffusion.py", line 279, in p_mean_variance estimate_noise = model(x_t, t) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/dell/local/HK/AnoDDPM-master/UNet.py", line 400, in forward h = module(h, time_embed) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/dell/local/HK/AnoDDPM-master/UNet.py", line 35, in forward x = layer(x) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 399, in forward return self._conv_forward(input, self.weight, self.bias) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 396, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: Given groups=1, weight of size [128, 1, 3, 3], expected input[1, 3, 256, 256] to have 1 channels, but got 3 channels instead
I wonder if there is something wrong with my detection call (I did not change your code) :
Maybe my question is relatively simple, but it has really caused me a lot of trouble. I would like to express my deep thanks again for troubling you.
The direct test methods had a couple of bugs towards the end of my development, so I apologise. Clearly, a device error here should be quick and easy to fix and rerun?
Regarding the second issue.
It is hard to say what the specific issue is here with the model being so large. However, it is evidently a channel issue; so I would ensure that the resulting channels are as expected throughout the Simplex calculations, and when passing the image into the model.
Any further issues, please feel free to reach out.
from anoddpm.
Hello author, I am honored to read your paper. After completing leather data set training, I tried to detect, but encountered some problems: Here is my args file:
args19.json { "img_size": [256,256], "Batch_Size": 1, "EPOCHS": 1000, "T": 1000, "base_channels": 128, "beta_schedule": "linear", "channel_mults": "", "loss-type": "l2", "loss_weight": "none", "train_start": true, "lr": 1e-4, "random_slice": true, "sample_distance": 600, "weight_decay": 0.0, "save_imgs":true, "save_vids":true, "dropout":0, "attention_resolutions":"16,8", "num_heads":2, "num_head_channels":-1, "noise_fn":"simplex", "dataset":"leather", "channels": 1 }
After the training:
- Error is reported in evaluation.testing() immediately after train:
File "diffusion_training.py", line 153, in train evaluation.testing(testing_dataset_loader, diffusion, ema=ema, args=args, model=model) File "/home/dell/local/HK/AnoDDPM-master/evaluation.py", line 124, in testing x = x.to(device) NameError: name 'device' is not defined
- When I tried detection, I entered the following command:
python3 detection.py args19.json
Here, args19.json is the configuration file I trained with
But the following error is reported:This is the shape of the layer for the row where the error occurred Conv2d(1, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)
Traceback (most recent call last): File "detection.py", line 959, in anomalous_metric_calculation() File "detection.py", line 226, in anomalous_metric_calculation t_distance=200, denoise_fn=args["noise_fn"] File "/home/dell/local/HK/AnoDDPM-master/GaussianDiffusion.py", line 354, in forward_backward out = self.sample_p(model, x, t_batch, denoise_fn) File "/home/dell/local/HK/AnoDDPM-master/GaussianDiffusion.py", line 299, in sample_p out = self.p_mean_variance(model, x_t, t) File "/home/dell/local/HK/AnoDDPM-master/GaussianDiffusion.py", line 279, in p_mean_variance estimate_noise = model(x_t, t) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/dell/local/HK/AnoDDPM-master/UNet.py", line 400, in forward h = module(h, time_embed) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/dell/local/HK/AnoDDPM-master/UNet.py", line 35, in forward x = layer(x) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 399, in forward return self._conv_forward(input, self.weight, self.bias) File "/home/dell/anaconda3/envs/pytorch181/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 396, in _conv_forward self.padding, self.dilation, self.groups) RuntimeError: Given groups=1, weight of size [128, 1, 3, 3], expected input[1, 3, 256, 256] to have 1 channels, but got 3 channels instead
I wonder if there is something wrong with my detection call (I did not change your code) :
Maybe my question is relatively simple, but it has really caused me a lot of trouble. I would like to express my deep thanks again for troubling you.The direct test methods had a couple of bugs towards the end of my development, so I apologise. Clearly, a device error here should be quick and easy to fix and rerun?
Regarding the second issue. It is hard to say what the specific issue is here with the model being so large. However, it is evidently a channel issue; so I would ensure that the resulting channels are as expected throughout the Simplex calculations, and when passing the image into the model. Any further issues, please feel free to reach out.
Hello, Professor, your work is very wonderful, but I have some questions when I reproduce your paper, that is, why can the batchsize only be 1? When I change it to a different multiple, the model will report an error during the diffusion process
from anoddpm.
Hello, Professor, your work is very wonderful, but I have some questions when I reproduce your paper, that is, why can the batchsize only be 1? When I change it to a different multiple, the model will report an error during the diffusion process
Moved to new issue
from anoddpm.
Related Issues (20)
- some doubts about the principle of the diffusion model HOT 1
- some questions about DDPM HOT 1
- Some problems with running detection HOT 2
- Batch Size HOT 3
- Where is the file of args used in the paper? HOT 2
- How Train and Test is split. HOT 2
- comparasion_models HOT 5
- What is a directory raw_cleaned ? HOT 7
- about the training time cost HOT 1
- Some problems about data HOT 1
- Encountered Access Issue of E-mail HOT 1
- Package Versions / Install Requirements? HOT 1
- how to get testData HOT 2
- high CPU usage discovered in training stage HOT 1
- result for MVTec HOT 1
- Asking about "import Comparative_models.CE as CE" HOT 2
- Problem about saving .mp4 files during training process HOT 3
- Access to training args.json used in the paper
- Pre-trained data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anoddpm.