回答編集履歴
2
d
answer
CHANGED
@@ -45,4 +45,24 @@
|
|
45
45
|
入力
|
46
46
|
|
47
47
|

|
48
|
-
出力
|
48
|
+
出力
|
49
|
+
|
50
|
+
## 追記
|
51
|
+
|
52
|
+
次元は変わらないですが、crop しているので、形状は変わります。
|
53
|
+
|
54
|
+
```python
|
55
|
+
import tensorflow as tf
|
56
|
+
|
57
|
+
h, w = 1000, 1000
|
58
|
+
input_tensor = tf.placeholder(tf.uint8, [None, h, w, 3])
|
59
|
+
output = tf.map_fn(lambda img: tf.random_crop(img, [500, 500, 3]), input_tensor)
|
60
|
+
|
61
|
+
print(input_tensor.shape)
|
62
|
+
print(output.shape)
|
63
|
+
```
|
64
|
+
|
65
|
+
```
|
66
|
+
(?, 1000, 1000, 3)
|
67
|
+
(?, 500, 500, 3)
|
68
|
+
```
|
1
d
answer
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
Python の map() 関数同様に以下のように使います。
|
6
6
|
|
7
7
|
```python
|
8
|
-
tf.map_fn(lambda img: tf.random_crop(img, [500, 500, 3])
|
8
|
+
tf.map_fn(lambda img: tf.random_crop(img, [500, 500, 3]), input_tensor)
|
9
9
|
```
|
10
10
|
|
11
11
|
## サンプルコード
|