回答編集履歴

1

Issue の参考コメントを掲載

2021/01/13 14:58

投稿

Surpris
Surpris

スコア106

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  そこで以下のように `keras.backend.image_data_format()` を使用すれば該当エラーが解消されるかと思います:
8
8
 
9
- ```python
9
+ ```Python
10
10
 
11
11
  if K.image_data_format() == 'channels_first': # <- ココを変更
12
12
 
@@ -32,6 +32,50 @@
32
32
 
33
33
  https://github.com/keras-team/keras/issues/12649
34
34
 
35
- 関数が返す値の対応関係については、上記 Issue の `TheHugeManatee commented on 7 Apr 2020` をご参考ください
35
+ 関数が返す値の対応関係については、上記 Issue の `TheHugeManatee commented on 7 Apr 2020` をご参考ください
36
36
 
37
+ ```
38
+
39
+ # TheHugeManatee commented on 7 Apr 2020
40
+
41
+ The way I understand it, with the new API:
42
+
43
+ setting:
44
+
45
+ K.set_image_dim_ordering('tf') --> K.set_image_data_format('channels_last')
46
+
47
+ K.set_image_dim_ordering('th') --> K.set_image_data_format('channels_first')
48
+
49
+
50
+
51
+ checking:
52
+
53
+ K.image_dim_ordering() == 'tf' --> K.image_data_format() == 'channels_last'
54
+
55
+ K.image_dim_ordering() == 'th' --> K.image_data_format() == 'channels_first'
56
+
57
+
58
+
59
+ I'm not very familiar with it so there might be other edge cases.
60
+
61
+
62
+
63
+ [Edited: Corrected the order as per @CarMiranda 's comment below]
64
+
65
+ ```
66
+
67
+
68
+
37
- また、上記 Issue の `aclex commented on 20 Sep 2019` によれば v2.2.4 -> v2.2.5 のタイミングで関数の変更が入ったようです
69
+ また、上記 Issue の `aclex commented on 20 Sep 2019` によれば v2.2.4 -> v2.2.5 のタイミングで関数の変更が入ったようです
70
+
71
+ ```
72
+
73
+ # aclex commented on 20 Sep 2019
74
+
75
+ From my little version-wise research, this attribute disappears in 2.2.4 -> 2.2.5 version change. So in my case everything still works fine with 2.2.4.
76
+
77
+
78
+
79
+ Thanks everyone for suggestions to fix it!
80
+
81
+ ```