@@ -25,22 +25,23 @@ export class TinyYolov2 extends NeuralNetwork<NetParams> {
25
25
}
26
26
27
27
const out = tf . tidy ( ( ) => {
28
- const batchTensor = input . toBatchTensor ( 416 ) . div ( tf . scalar ( 255 ) ) . toFloat ( )
28
+ // const batchTensor = input.toBatchTensor(416).div(tf.scalar(255)).toFloat() as tf.Tensor4D
29
29
30
- let out = tf . pad ( batchTensor , [ [ 0 , 0 ] , [ 1 , 1 ] , [ 1 , 1 ] , [ 0 , 0 ] ] ) as tf . Tensor4D
30
+ // TODO: fix boxes after padding
31
+ const batchTensor = tf . image . resizeBilinear ( input . inputs [ 0 ] , [ 416 , 416 ] ) . toFloat ( ) . div ( tf . scalar ( 255 ) ) . expandDims ( ) as tf . Tensor4D
31
32
32
- out = convWithBatchNorm ( out , params . conv0 )
33
- out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'valid ' )
33
+ let out = convWithBatchNorm ( batchTensor , params . conv0 )
34
+ out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'same ' )
34
35
out = convWithBatchNorm ( out , params . conv1 )
35
- out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'valid ' )
36
+ out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'same ' )
36
37
out = convWithBatchNorm ( out , params . conv2 )
37
- out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'valid ' )
38
+ out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'same ' )
38
39
out = convWithBatchNorm ( out , params . conv3 )
39
- out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'valid ' )
40
+ out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'same ' )
40
41
out = convWithBatchNorm ( out , params . conv4 )
41
- out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'valid ' )
42
+ out = tf . maxPool ( out , [ 2 , 2 ] , [ 2 , 2 ] , 'same ' )
42
43
out = convWithBatchNorm ( out , params . conv5 )
43
- out = tf . maxPool ( out , [ 2 , 2 ] , [ 1 , 1 ] , 'valid ' )
44
+ out = tf . maxPool ( out , [ 2 , 2 ] , [ 1 , 1 ] , 'same ' )
44
45
out = convWithBatchNorm ( out , params . conv6 )
45
46
out = convWithBatchNorm ( out , params . conv7 )
46
47
out = convLayer ( out , params . conv8 , 'valid' , false )
0 commit comments