Yolo v4를 하나씩 쪼개가면서 알게된 신기한 점에 대해서 글을 간략하게 작성해본다.
tf.reshape를 하게 된다면
다음과 같이 tf_op_layer_Shape, tf_op_layer_strided_slice, tf_op_layer_Reshape/shape, tf_op_layer_Reshape 순서로
진행되는 모습을 볼 수 있다.
tf.reshape를 통해서 model을 만들 경우에는 tf.reshape 한 줄 이지만,
이후 model을 load하여 layer를 확인하는 경우에는 위에 언급한 3개의 레이어가 추가적으로 layer로 인식된다는 점이 있다.
또, Yolo v4를 다 통과하고, 이후에 decode를 진행할 경우에
xy_grid = tf.meshgrid(tf.range(output_size), tf.range(output_size))
xy_grid = tf.expand_dims(tf.stack(xy_grid, axis=-1), axis=2) # [gx, gy, 1, 2]
xy_grid = tf.tile(tf.expand_dims(xy_grid, axis=0), [batch_size, 1, 1, 3, 1])
xy_grid = tf.cast(xy_grid, tf.float32)
다음과 같은 블럭이 존재하는데,
해당 블럭을 unit-test를 통해서 plot해보면
다음처럼 layer가 생성된다. 따라서 알 수 있었던 점은, tf.reshape나 tf.meshgrid 나 둘다 tf_op_layer_Shape와 tf_op_layer_strided_slice를 지나 작업을 하게되기 때문에
다음과 같이 연결되어 있다고 볼 수 있겠다...
'끄적끄적' 카테고리의 다른 글
PET의 Encoder 개수에 대한 고찰 (0) | 2024.03.14 |
---|---|
TFLite visualizing (0) | 2023.04.06 |
Yolo v4 Set up (0) | 2023.02.23 |
layer merge하는 경우 수행 시간에 대한 고찰 (0) | 2023.02.17 |
TensorFlow관련 주저리... (0) | 2023.02.06 |