質問編集履歴

6

ソースコード一部修正

2021/02/24 04:01

投稿

tanuki_
tanuki_

スコア40

test CHANGED
File without changes
test CHANGED
@@ -312,9 +312,9 @@
312
312
 
313
313
  import image_dataset
314
314
 
315
- #train_images ,train_labels, test_images ,test_labels = image_dataset.make('C:/Users/cv/dataset',img_size = 28, train_num=10000 , test_num =1000)
315
+ #train_images ,train_labels, test_images ,test_labels = image_dataset.make('C:/Users/dataset',img_size = 28, train_num=10000 , test_num =1000)
316
-
316
+
317
- train_images ,train_labels, test_images ,test_labels = image_dataset.make('C:/Users/cv/dataset',img_size = 45, train_num=10000 , test_num =1000)
317
+ train_images ,train_labels, test_images ,test_labels = image_dataset.make('C:/Users/dataset',img_size = 45, train_num=10000 , test_num =1000)
318
318
 
319
319
 
320
320
 

5

print(train_labels.shape)の結果追記

2021/02/24 04:01

投稿

tanuki_
tanuki_

スコア40

test CHANGED
File without changes
test CHANGED
@@ -486,6 +486,16 @@
486
486
 
487
487
  ```
488
488
 
489
+ print(train_labels.shape)の結果
490
+
491
+ ```
492
+
493
+ (10,10)
494
+
495
+ ```
496
+
497
+
498
+
489
499
  Tensorflow2.4.1
490
500
 
491
501
  Python3.7

4

x3の考慮をして実行した結果を反映

2021/02/19 23:31

投稿

tanuki_
tanuki_

スコア40

test CHANGED
File without changes
test CHANGED
@@ -4,13 +4,31 @@
4
4
 
5
5
  が発生してしまいます。
6
6
 
7
+ ネットワークの入力を、
8
+
9
+ ```python
10
+
11
+ input_shape=(45, 45,3)
12
+
13
+ ```
14
+
15
+ とした所、当初のエラーは解消されたように見えます。
16
+
17
+ 今度は、
18
+
19
+ tensorflow.python.framework.errors_impl.InvalidArgumentError: logits and labels must have the same first dimension, got logits shape [10,10] and labels shape [100]
20
+
21
+ というエラーが出ます。
22
+
23
+
24
+
7
25
  CNNをはじめて実装したので,原因がよくわかっていません。
8
26
 
9
27
  わかる方.宜しくお願い致します。
10
28
 
11
29
 
12
30
 
13
- データセット作成で使用している画像(2値化していてグレスケールです。)(45×45)
31
+ データセット作成で使用している画像(カラー)(45×45×3
14
32
 
15
33
 
16
34
 
@@ -304,7 +322,11 @@
304
322
 
305
323
 
306
324
 
307
- print(train_images.shape, train_labels.shape)
325
+ #print(train_images.shape, train_labels.shape)
326
+
327
+ print('train_images.shape:')
328
+
329
+ print(train_images.shape)
308
330
 
309
331
 
310
332
 
@@ -366,7 +388,7 @@
366
388
 
367
389
  model = tf.keras.Sequential([
368
390
 
369
- tf.keras.layers.Flatten(input_shape=(45, 45), name='flatten_layer'),
391
+ tf.keras.layers.Flatten(input_shape=(45, 45,3), name='flatten_layer'),
370
392
 
371
393
  tf.keras.layers.Dense(128, activation='relu'),
372
394
 
@@ -378,7 +400,7 @@
378
400
 
379
401
 
380
402
 
381
- model.summary()
403
+ #model.summary()
382
404
 
383
405
 
384
406
 
@@ -418,11 +440,11 @@
418
440
 
419
441
  ```
420
442
 
421
- 2021-02-19 10:36:53.212781: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not f
443
+ 2021-02-19 13:07:03.954106: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not f
422
444
 
423
445
  ound
424
446
 
425
- 2021-02-19 10:36:53.222390: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
447
+ 2021-02-19 13:07:03.956781: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
426
448
 
427
449
  2.4.1
428
450
 
@@ -430,47 +452,29 @@
430
452
 
431
453
  1read complete ,2 pictures exit
432
454
 
455
+ train_images.shape:
456
+
433
- (10, 6075) (10, 10)
457
+ (10, 6075)
434
-
458
+
435
- 2021-02-19 10:36:58.205349: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
459
+ 2021-02-19 13:07:06.893626: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
436
-
437
- 2021-02-19 10:36:58.211576: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
438
-
439
- 2021-02-19 10:36:58.225199: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
440
-
441
- 2021-02-19 10:36:58.234604: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: CVPC-0164
442
-
443
- 2021-02-19 10:36:58.237883: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: CVPC-0164
444
-
445
- 2021-02-19 10:36:58.242605: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use t
446
-
447
- he following CPU instructions in performance-critical operations: AVX2
448
-
449
- To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
450
-
451
- 2021-02-19 10:36:58.255253: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
452
-
453
- Model: "sequential"
454
460
 
455
461
  ~中略~
456
462
 
457
- ~中略~
458
-
459
- packages\tensorflow\python\keras\engine\base_layer.py:998 __call__
463
+ packages\tensorflow\python\eager\execute.py", line 59, in quick_execute
460
-
464
+
461
- input_spec.assert_input_compatibility(self.input_spec, inputs, self.name)
465
+ tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
462
-
463
- C:\Users\cv\anaconda3\envs\tensorflow-cpu\lib\site-packages\tensorflow\python\keras\engine\input_spec.py:255 assert_input_compatibility
466
+
464
-
465
- raise ValueError(
466
-
467
-
468
-
469
- ValueError: Input 0 of layer dense is incompatible with the layer: expected axis -1 of input shape to have value 2025 but received input with shape (None, 6075)
467
+ tensorflow.python.framework.errors_impl.InvalidArgumentError: logits and labels must have the same first dimension, got logits shape [10,10] and labels shape [100]
468
+
470
-
469
+ [[node sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLogits/SparseSoftmaxCrossEntropyWithLogits (defined at cnn_image.py:66) ]] [Op:__inference_train_
470
+
471
-
471
+ function_571]
472
+
473
+
474
+
472
-
475
+ Function call stack:
476
+
473
- PS C:\Users>
477
+ train_function
474
478
 
475
479
  ```
476
480
 

3

print(train_images.shape)の結果を追記

2021/02/19 05:31

投稿

tanuki_
tanuki_

スコア40

test CHANGED
File without changes
test CHANGED
@@ -474,6 +474,14 @@
474
474
 
475
475
  ```
476
476
 
477
+ print(train_images.shape)の結果
478
+
479
+ ```
480
+
481
+ (10, 6075)
482
+
483
+ ```
484
+
477
485
  Tensorflow2.4.1
478
486
 
479
487
  Python3.7

2

説明

2021/02/19 03:40

投稿

tanuki_
tanuki_

スコア40

test CHANGED
File without changes
test CHANGED
@@ -10,7 +10,9 @@
10
10
 
11
11
 
12
12
 
13
- データセット作成で使用している画像(2値化していす)(45×45)
13
+ データセット作成で使用している画像(2値化していてグレースケールで)(45×45)
14
+
15
+
14
16
 
15
17
  ![イメージ説明](ef05e1b3b72b1e6fb7117aa5d560359b.jpeg)
16
18
 

1

説明文修正

2021/02/19 03:14

投稿

tanuki_
tanuki_

スコア40

test CHANGED
File without changes
test CHANGED
@@ -4,7 +4,11 @@
4
4
 
5
5
  が発生してしまいます。
6
6
 
7
+ CNNをはじめて実装したので,原因がよくわかっていません。
8
+
7
- 対処法をご教示頂けると幸す。
9
+ わかる.宜しくお願致します。
10
+
11
+
8
12
 
9
13
  データセット作成で使用している画像(2値化しています)(45×45)
10
14