1
- from _limap import _features
2
1
import numpy as np
2
+ from _limap import _features
3
3
4
4
5
5
def write_patch (fname , patch , dtype = "float16" ):
@@ -17,7 +17,7 @@ def write_patch(fname, patch, dtype="float16"):
17
17
18
18
def load_patch (fname , dtype = "float16" ):
19
19
# return a PatchInfo_f object
20
- patch_info_name = "PatchInfo_f{0}" . format ( dtype [- 2 :])
20
+ patch_info_name = f "PatchInfo_f{ dtype [- 2 :]} "
21
21
with open (fname , "rb" ) as f :
22
22
data = np .load (f , allow_pickle = True )
23
23
patch = getattr (_features , patch_info_name )(
@@ -28,7 +28,7 @@ def load_patch(fname, dtype="float16"):
28
28
29
29
def get_extractor (cfg , channels ):
30
30
lpe_options = _features .LinePatchExtractorOptions (cfg )
31
- patch_extractor_name = "LinePatchExtractor_f64_c{0}" . format ( channels )
31
+ patch_extractor_name = f "LinePatchExtractor_f64_c{ channels } "
32
32
extractor = getattr (_features , patch_extractor_name )(lpe_options )
33
33
return extractor
34
34
@@ -39,9 +39,7 @@ def extract_line_patch_oneimage(cfg, track, img_id, camview, feature):
39
39
_features.PatchInfo_fx
40
40
"""
41
41
lpe_options = _features .LinePatchExtractorOptions (cfg )
42
- patch_extractor_name = "LinePatchExtractor_f64_c{0}" .format (
43
- feature .shape [2 ]
44
- )
42
+ patch_extractor_name = f"LinePatchExtractor_f64_c{ feature .shape [2 ]} "
45
43
extractor = getattr (_features , patch_extractor_name )(lpe_options )
46
44
patch = extractor .ExtractOneImage (track , img_id , camview , feature )
47
45
return patch
@@ -53,9 +51,7 @@ def extract_line_patches(cfg, track, p_camviews, p_features):
53
51
list of _features.PatchInfo_fx
54
52
"""
55
53
lpe_options = _features .LinePatchExtractorOptions (cfg )
56
- patch_extractor_name = "LinePatchExtractor_f64_c{0}" .format (
57
- p_features [0 ].shape [2 ]
58
- )
54
+ patch_extractor_name = f"LinePatchExtractor_f64_c{ p_features [0 ].shape [2 ]} "
59
55
extractor = getattr (_features , patch_extractor_name )(lpe_options )
60
56
patches = extractor .Extract (track , p_camviews , p_features )
61
57
return patches
0 commit comments