wangerniu commited on
Commit
64a50e9
·
1 Parent(s): 182c5b2
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -29,6 +29,12 @@ image_path = 'images/00000.jpg'
29
  # tile_size_meters = 128
30
  model = Demo(experiment_or_path=experiment_or_path, num_rotations=128, device='cpu')
31
 
 
 
 
 
 
 
32
  def demo_localize(image,long,lat,tile_size_meters):
33
  # inp = Image.fromarray(inp.astype('uint8'), 'RGB')
34
  # inp = transforms.ToTensor()(inp).unsqueeze(0)
@@ -78,15 +84,23 @@ def demo_localize(image,long,lat,tile_size_meters):
78
  # model = torch.hub.load('pytorch/vision:v0.6.0', 'resnet18', pretrained=True).eval()
79
  #标题
80
  title = "MapLocNet"
 
81
  #标题下的描述,支持md格式
82
- description = "UAV Vision-based Geo-Localization Using Vectorized Maps"
83
 
84
  # outputs = gr.outputs.Label(num_top_classes=3)
85
- outputs = gr.Plot()
 
 
 
 
 
 
 
86
  interface = gr.Interface(fn=demo_localize,
87
- inputs=["image",
88
- gr.Number(label="Prior location-longitude)"),
89
- gr.Number(label="Prior location-longitude)"),
90
  gr.Radio([64, 128, 256], label="Search radius (meters)", info="vectorized map size"),
91
  # gr.inputs.RadioGroup(label="Search radius (meters)",["English", "French", "Spanish"]),
92
  # gr.Slider(64, 512,label='Search radius (meters)')
@@ -94,5 +108,5 @@ interface = gr.Interface(fn=demo_localize,
94
  outputs=["plot","plot","text"],
95
  title=title,
96
  description=description,
97
- examples=[['images/00000.jpg',-122.435941445631,37.75704325989902,128]])
98
  interface.launch()
 
29
  # tile_size_meters = 128
30
  model = Demo(experiment_or_path=experiment_or_path, num_rotations=128, device='cpu')
31
 
32
+ # def build_examples(root,num):
33
+ # images=os.listdir(root)
34
+ # info = []
35
+ # for i in range(len(images)):
36
+
37
+ # pass
38
  def demo_localize(image,long,lat,tile_size_meters):
39
  # inp = Image.fromarray(inp.astype('uint8'), 'RGB')
40
  # inp = transforms.ToTensor()(inp).unsqueeze(0)
 
84
  # model = torch.hub.load('pytorch/vision:v0.6.0', 'resnet18', pretrained=True).eval()
85
  #标题
86
  title = "MapLocNet"
87
+ title="<h1 align="center"><ins>MapLocNet</ins><br>UAV Vision-based Geo-Localization<br>Using Vectorized Maps</h1>"
88
  #标题下的描述,支持md格式
89
+ description = "OrienterNet finds the position and orientation of UAV image using OpenStreetMap. Click on one of the provided examples or upload your own UAV image!"
90
 
91
  # outputs = gr.outputs.Label(num_top_classes=3)
92
+ # outputs = gr.Plot()
93
+
94
+ examples=[
95
+ ['images/00000.jpg',-122.435941445631,37.75704325989902,128],
96
+ ['images/00011.jpg',-122.4115887,37.76847628,128],
97
+ ['images/00022.jpg',-122.4421809,37.77668392,128],
98
+ ['images/00033.jpg',-122.4384978,37.76426403,128],
99
+ ]
100
  interface = gr.Interface(fn=demo_localize,
101
+ inputs=["UAV image",
102
+ gr.Number(label="The center longitude of the map"),
103
+ gr.Number(label="The central latitude of the map"),
104
  gr.Radio([64, 128, 256], label="Search radius (meters)", info="vectorized map size"),
105
  # gr.inputs.RadioGroup(label="Search radius (meters)",["English", "French", "Spanish"]),
106
  # gr.Slider(64, 512,label='Search radius (meters)')
 
108
  outputs=["plot","plot","text"],
109
  title=title,
110
  description=description,
111
+ examples=examples)
112
  interface.launch()