LeeDoYup / AnoGAN-tf

Unofficial Tensorflow Implementation of AnoGAN (Anomaly GAN)
MIT License
270 stars 92 forks source link

attributeError: 'DCGAN' object has no attribute 'test_data_names' #31

Open Freelancefangjian opened 5 years ago

lzzlxxlsz commented 5 years ago

hello.have you run the code successfully? and how about the test result?

LeeDoYup commented 5 years ago

sorry for late comment. I think ther is no self.test_data_names in DCGAN class. could you let me know your detail contexts of error?

sachitha-bandara commented 4 years ago

@LeeDoYup I have the same issue.

LeeDoYup commented 4 years ago

could you let me know which lines and what is the context of run?

sachitha-bandara commented 4 years ago

could you let me know which lines and what is the context of run?

I re-traced the problem back (I used try pass to avoid this issue) and below is the issue.

(tf) C:\Users\SCB\Desktop\FYP\AnoGAN-tf-master\AnoGAN-tf-master>python main.py --dataset DATASET_NAME --batch_size=58 --input_height=128 --input_width=128 --output_height=128 --output_width=128 --input_fname_pattern=".png" --crop --anomaly_test {'anomaly_test': True, 'batch_size': 58, 'beta1': 0.5, 'checkpoint_dir': 'checkpoint', 'crop': True, 'dataset': 'DATASET_NAME', 'epoch': 25, 'generate_test_images': 100, 'input_fname_pattern': '.png', 'input_height': 128, 'input_width': 128, 'learning_rate': 0.0002, 'output_height': 128, 'output_width': 128, 'sample_dir': 'samples', 'test_batch_size': 1, 'test_dir': 'test_data', 'test_epoch': 100, 'test_learning_rate': 0.001, 'test_result_dir': 'test_result', 'train': False, 'train_size': inf, 'visualize': False} 2020-03-16 19:53:49.704995: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations. 2020-03-16 19:53:49.705063: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations. 2020-03-16 19:53:49.705359: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. 2020-03-16 19:53:49.705769: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2020-03-16 19:53:49.706040: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2020-03-16 19:53:49.706359: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2020-03-16 19:53:49.706674: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2020-03-16 19:53:49.706968: W c:\l\tensorflow_1501918863922\work\tensorflow-1.2.1\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.

Variables: name (type shape) [size]

generator/g_h0_lin/Matrix:0 (float32_ref 100x32768) [3276800, bytes: 13107200] generator/g_h0_lin/bias:0 (float32_ref 32768) [32768, bytes: 131072] generator/g_bn0/beta:0 (float32_ref 512) [512, bytes: 2048] generator/g_bn0/gamma:0 (float32_ref 512) [512, bytes: 2048] generator/g_h1/w:0 (float32_ref 5x5x256x512) [3276800, bytes: 13107200] generator/g_h1/biases:0 (float32_ref 256) [256, bytes: 1024] generator/g_bn1/beta:0 (float32_ref 256) [256, bytes: 1024] generator/g_bn1/gamma:0 (float32_ref 256) [256, bytes: 1024] generator/g_h2/w:0 (float32_ref 5x5x128x256) [819200, bytes: 3276800] generator/g_h2/biases:0 (float32_ref 128) [128, bytes: 512] generator/g_bn2/beta:0 (float32_ref 128) [128, bytes: 512] generator/g_bn2/gamma:0 (float32_ref 128) [128, bytes: 512] generator/g_h3/w:0 (float32_ref 5x5x64x128) [204800, bytes: 819200] generator/g_h3/biases:0 (float32_ref 64) [64, bytes: 256] generator/g_bn3/beta:0 (float32_ref 64) [64, bytes: 256] generator/g_bn3/gamma:0 (float32_ref 64) [64, bytes: 256] generator/g_h4/w:0 (float32_ref 5x5x3x64) [4800, bytes: 19200] generator/g_h4/biases:0 (float32_ref 3) [3, bytes: 12] discriminator/d_h0_conv/w:0 (float32_ref 5x5x3x64) [4800, bytes: 19200] discriminator/d_h0_conv/biases:0 (float32_ref 64) [64, bytes: 256] discriminator/d_h1_conv/w:0 (float32_ref 5x5x64x128) [204800, bytes: 819200] discriminator/d_h1_conv/biases:0 (float32_ref 128) [128, bytes: 512] discriminator/d_bn1/beta:0 (float32_ref 128) [128, bytes: 512] discriminator/d_bn1/gamma:0 (float32_ref 128) [128, bytes: 512] discriminator/d_h2_conv/w:0 (float32_ref 5x5x128x256) [819200, bytes: 3276800] discriminator/d_h2_conv/biases:0 (float32_ref 256) [256, bytes: 1024] discriminator/d_bn2/beta:0 (float32_ref 256) [256, bytes: 1024] discriminator/d_bn2/gamma:0 (float32_ref 256) [256, bytes: 1024] discriminator/d_h3_conv/w:0 (float32_ref 5x5x256x512) [3276800, bytes: 13107200] discriminator/d_h3_conv/biases:0 (float32_ref 512) [512, bytes: 2048] discriminator/d_bn3/beta:0 (float32_ref 512) [512, bytes: 2048] discriminator/d_bn3/gamma:0 (float32_ref 512) [512, bytes: 2048] discriminator/d_h4_lin/Matrix:0 (float32_ref 32768x1) [32768, bytes: 131072] discriminator/d_h4_lin/bias:0 (float32_ref 1) [1, bytes: 4] Total size of variables: 11958660 Total bytes of variables: 47834640 [] Reading checkpoints... [] Success to read DCGAN.model-2 the shitty thumb file Bypassing none type ........ Traceback (most recent call last): File "main.py", line 128, in tf.app.run() File "C:\Program Files\Anaconda3\envs\tf\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 112, in main dcgan.anomaly_detector() File "C:\Users\SCB\Desktop\FYP\AnoGAN-tf-master\AnoGAN-tf-master\model.py", line 464, in anomaly_detector self.get_test_data() File "C:\Users\SCB\Desktop\FYP\AnoGAN-tf-master\AnoGAN-tf-master\model.py", line 453, in get_test_data batch_images = np.array(batch).astype(np.float32) ValueError: setting an array element with a sequence.

If i used a try-pass method in here also, I get the attribute error at DCGAN class

sachitha-bandara commented 4 years ago

@LeeDoYup the reason i used try-pass is because the windows system automatically creates thumb.db files and errors happen when trying to read them as images. I tried removing them from cmd, but i guess the db files are created at runtime. so i had to bypass reading the db files. I have no previous experience with tensorflow

sachitha-bandara commented 4 years ago

The error is fixed. it is due to thumb.db files created at runtime in win 10.