1- import math
2-
31import mmcv
2+ import numpy as np
43import torch
54from torch .utils .data import Dataset
65
@@ -21,33 +20,36 @@ def create_real_pyramid(real, min_size, max_size, scale_factor_init):
2120 scale_factor_init (float): The initial scale factor.
2221 """
2322
24- num_scales = math .ceil (
25- math .log (
26- math .pow (min_size / min (real .shape [0 ], real .shape [1 ]), 1 ),
27- scale_factor_init )) + 1
23+ num_scales = int (
24+ np .ceil (
25+ np .log (
26+ np .power (min_size / min (real .shape [0 ], real .shape [1 ]), 1 ),
27+ scale_factor_init ))) + 1
2828
29- scale2stop = math .ceil (
30- math .log (
31- min ([max_size , max ([real .shape [0 ], real .shape [1 ]])]) /
32- max ([real .shape [0 ], real .shape [1 ]]), scale_factor_init ))
29+ scale2stop = int (
30+ np .ceil (
31+ np .log (
32+ min ([max_size , max ([real .shape [0 ], real .shape [1 ]])]) /
33+ max ([real .shape [0 ], real .shape [1 ]]), scale_factor_init )))
3334
3435 stop_scale = num_scales - scale2stop
3536
3637 scale1 = min (max_size / max ([real .shape [0 ], real .shape [1 ]]), 1 )
3738 real_max = mmcv .imrescale (real , scale1 )
38- scale_factor = math . pow (
39+ scale_factor = np . power (
3940 min_size / (min (real_max .shape [0 ], real_max .shape [1 ])),
4041 1 / (stop_scale ))
4142
42- scale2stop = math .ceil (
43- math .log (
44- min ([max_size , max ([real .shape [0 ], real .shape [1 ]])]) /
45- max ([real .shape [0 ], real .shape [1 ]]), scale_factor_init ))
43+ scale2stop = int (
44+ np .ceil (
45+ np .log (
46+ min ([max_size , max ([real .shape [0 ], real .shape [1 ]])]) /
47+ max ([real .shape [0 ], real .shape [1 ]]), scale_factor_init )))
4648 stop_scale = num_scales - scale2stop
4749
4850 reals = []
4951 for i in range (stop_scale + 1 ):
50- scale = math . pow (scale_factor , stop_scale - i )
52+ scale = np . power (scale_factor , stop_scale - i )
5153 curr_real = mmcv .imrescale (real , scale )
5254 reals .append (curr_real )
5355
0 commit comments