回答編集履歴
2
d
test
CHANGED
@@ -93,3 +93,43 @@
|
|
93
93
|
![イメージ説明](d5f8a8d63342ca161f9b81ff1e95b96a.png)
|
94
94
|
|
95
95
|
出力
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
## 追記
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
次元は変わらないですが、crop しているので、形状は変わります。
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
```python
|
108
|
+
|
109
|
+
import tensorflow as tf
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
h, w = 1000, 1000
|
114
|
+
|
115
|
+
input_tensor = tf.placeholder(tf.uint8, [None, h, w, 3])
|
116
|
+
|
117
|
+
output = tf.map_fn(lambda img: tf.random_crop(img, [500, 500, 3]), input_tensor)
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
print(input_tensor.shape)
|
122
|
+
|
123
|
+
print(output.shape)
|
124
|
+
|
125
|
+
```
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
```
|
130
|
+
|
131
|
+
(?, 1000, 1000, 3)
|
132
|
+
|
133
|
+
(?, 500, 500, 3)
|
134
|
+
|
135
|
+
```
|
1
d
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
```python
|
14
14
|
|
15
|
-
tf.map_fn(lambda img: tf.random_crop(img, [500, 500, 3])
|
15
|
+
tf.map_fn(lambda img: tf.random_crop(img, [500, 500, 3]), input_tensor)
|
16
16
|
|
17
17
|
```
|
18
18
|
|