3v324v23 commited on
Commit
5b3b1fd
·
1 Parent(s): b345965

added more examples and better description

Browse files
app.py CHANGED
@@ -412,7 +412,9 @@ def search_and_retrieve(
412
  query_footprint = None
413
  if query_footprint_str:
414
  try:
 
415
  query_footprint = ast.literal_eval(query_footprint_str)
 
416
  query_footprint = [list(coord) for coord in query_footprint]
417
  except (ValueError, SyntaxError):
418
  logging.warning("Could not parse query footprint string.")
@@ -569,6 +571,7 @@ def search_and_retrieve(
569
 
570
  if __name__ == "__main__":
571
  example_list = []
 
572
  queries_folder = Path("./data/queries")
573
  if queries_folder.exists() and queries_folder.is_dir():
574
  image_extensions = ["*.jpg", "*.jpeg", "*.png"]
@@ -593,6 +596,19 @@ if __name__ == "__main__":
593
  else:
594
  logging.warning(f"Examples folder not found: {queries_folder}")
595
 
 
 
 
 
 
 
 
 
 
 
 
 
 
596
  model_description = """
597
  ## Model Details
598
  This is a public API for inference of the EarthLoc2 model, which implements the amazing works of:
@@ -601,7 +617,7 @@ if __name__ == "__main__":
601
  - AstroLoc (https://astro-loc.github.io/)
602
 
603
  ### Architecture
604
- - DINOv2 base with SALAD aggregator out dim = 3084
605
  - FAISS index ~ 8gb, indexes 161496 * 4 images (4 rotated versions) from 2021
606
 
607
  ### Training
@@ -612,8 +628,7 @@ if __name__ == "__main__":
612
  ### Performance
613
  - Achieves R@10 = 90.6 on the original EarthLoc test and val sets (when retrieving against whole db as is)
614
  - Overall performance is around 10% worse than AstroLoc (https://9d214e4bc329a5c3f9.gradio.live/)
615
- - Particularly not working well on very small or very large areas.
616
-
617
  ### Matching
618
  - Uses the Xfeat_steerers matcher with 2048 maximal number of keypoints, we recommend Master with 2048 if you have access to GPU (we are too poor for it).
619
  """
@@ -633,7 +648,7 @@ if __name__ == "__main__":
633
  with gr.Column(scale=2):
634
  image_input = gr.Image(
635
  type="pil",
636
- label="Aerial photos of Earth",
637
  height=400,
638
  )
639
  hidden_footprint_text = gr.Textbox(
@@ -654,13 +669,26 @@ if __name__ == "__main__":
654
 
655
  submit_btn = gr.Button("Localize Image", variant="primary")
656
 
657
- gr.Examples(
658
- examples=example_list,
659
- inputs=[image_input, hidden_footprint_text],
660
- label="Example Queries",
661
- examples_per_page=10,
662
- cache_examples=False,
663
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
664
 
665
  with gr.Column(scale=2):
666
  map_output = gr.HTML(label="Final Footprint Map")
 
412
  query_footprint = None
413
  if query_footprint_str:
414
  try:
415
+ print(query_footprint_str)
416
  query_footprint = ast.literal_eval(query_footprint_str)
417
+
418
  query_footprint = [list(coord) for coord in query_footprint]
419
  except (ValueError, SyntaxError):
420
  logging.warning("Could not parse query footprint string.")
 
571
 
572
  if __name__ == "__main__":
573
  example_list = []
574
+ google_examples = []
575
  queries_folder = Path("./data/queries")
576
  if queries_folder.exists() and queries_folder.is_dir():
577
  image_extensions = ["*.jpg", "*.jpeg", "*.png"]
 
596
  else:
597
  logging.warning(f"Examples folder not found: {queries_folder}")
598
 
599
+ google_folder = Path("./data/google_maps_queries")
600
+ if google_folder.exists() and google_folder.is_dir():
601
+ image_extensions = ["*.jpg", "*.jpeg", "*.png"]
602
+ google_files = []
603
+ for ext in image_extensions:
604
+ google_files.extend(google_folder.glob(ext))
605
+ if google_files:
606
+ num_google = min(10, len(google_files))
607
+ google_examples = [
608
+ [str(p), str(p.stem).split("_")[0]] # Empty footprint for Google Maps
609
+ for p in random.sample(google_files, num_google)
610
+ ]
611
+
612
  model_description = """
613
  ## Model Details
614
  This is a public API for inference of the EarthLoc2 model, which implements the amazing works of:
 
617
  - AstroLoc (https://astro-loc.github.io/)
618
 
619
  ### Architecture
620
+ - DINOv2 base with SALAD aggregator out dim = 3072
621
  - FAISS index ~ 8gb, indexes 161496 * 4 images (4 rotated versions) from 2021
622
 
623
  ### Training
 
628
  ### Performance
629
  - Achieves R@10 = 90.6 on the original EarthLoc test and val sets (when retrieving against whole db as is)
630
  - Overall performance is around 10% worse than AstroLoc (https://9d214e4bc329a5c3f9.gradio.live/)
631
+ - Works well on satelite images between 1000 sq.km and 50000 sq.km, smaller or higher areas will not produce good results.
 
632
  ### Matching
633
  - Uses the Xfeat_steerers matcher with 2048 maximal number of keypoints, we recommend Master with 2048 if you have access to GPU (we are too poor for it).
634
  """
 
648
  with gr.Column(scale=2):
649
  image_input = gr.Image(
650
  type="pil",
651
+ label="Aerial Photos of Earth",
652
  height=400,
653
  )
654
  hidden_footprint_text = gr.Textbox(
 
669
 
670
  submit_btn = gr.Button("Localize Image", variant="primary")
671
 
672
+ with gr.Row():
673
+ with gr.Column():
674
+ if example_list:
675
+ gr.Markdown("### ISS Example Queries")
676
+ gr.Examples(
677
+ examples=example_list,
678
+ inputs=[image_input, hidden_footprint_text],
679
+ examples_per_page=5,
680
+ cache_examples=False,
681
+ )
682
+
683
+ with gr.Column():
684
+ if google_examples:
685
+ gr.Markdown("### Google Maps Example Queries")
686
+ gr.Examples(
687
+ examples=google_examples,
688
+ inputs=[image_input, hidden_footprint_text],
689
+ examples_per_page=5,
690
+ cache_examples=False,
691
+ )
692
 
693
  with gr.Column(scale=2):
694
  map_output = gr.HTML(label="Final Footprint Map")
data/google_maps_queries/Bratislava_query_image.png ADDED

Git LFS Details

  • SHA256: cc918248b753208199794a15b6532f983f1e02aeef561507afe7ed38e18f81b1
  • Pointer size: 132 Bytes
  • Size of remote file: 1.61 MB
data/google_maps_queries/Bucharest_query_image.png ADDED

Git LFS Details

  • SHA256: b1ed53af0cd124565668f6b628631de35fd496fb5205959bd0c52fa84225f4a5
  • Pointer size: 131 Bytes
  • Size of remote file: 644 kB
data/google_maps_queries/Everest_query_image.png ADDED

Git LFS Details

  • SHA256: 986d1f8caa3ed322e21a86b3a8ae7c0de4b101501fc0596e794ade74adb3c827
  • Pointer size: 131 Bytes
  • Size of remote file: 807 kB
data/google_maps_queries/Galapagos Tilted_ query_image.png ADDED

Git LFS Details

  • SHA256: e31e95ce8c950a9968f07e713ddab5f2516c68d86032c39c1cbf73d6ac2112d8
  • Pointer size: 132 Bytes
  • Size of remote file: 1.72 MB
data/google_maps_queries/Grand Canyon_query_image.png ADDED

Git LFS Details

  • SHA256: cb08f7ea8174bf3d293447e80565d00c37ed1c18259cd31e4b785624076147f1
  • Pointer size: 131 Bytes
  • Size of remote file: 450 kB
data/google_maps_queries/Hokkaido_query_image.png ADDED

Git LFS Details

  • SHA256: a125b3e74763fd4a2fb3318f69bfab8e13c15275415e80d7f5ed255ad5f59bd5
  • Pointer size: 131 Bytes
  • Size of remote file: 662 kB
data/google_maps_queries/Peru_query_google_maps.png ADDED

Git LFS Details

  • SHA256: 1a1294cfd214b2f56bc4facc893eadbfbe9ff1114a0e15629b71dae494c831b1
  • Pointer size: 131 Bytes
  • Size of remote file: 994 kB
data/google_maps_queries/Taipei_query_image.png ADDED

Git LFS Details

  • SHA256: ea56dba3bb4a98334d52b5a4bf37675e6329a40b85a22c78ca4445ab7a36fd49
  • Pointer size: 132 Bytes
  • Size of remote file: 1.22 MB
data/google_maps_queries/Tokyo_query_image.png ADDED

Git LFS Details

  • SHA256: 8e416227c2e30eebb663add48557faa722aa7fc3eadb20c06dd9a4bfa75f5935
  • Pointer size: 132 Bytes
  • Size of remote file: 1.63 MB
data/google_maps_queries/Warszawa_query_image.png ADDED

Git LFS Details

  • SHA256: f362ac8e2e6c78e457ebe268d9fa57493ed3ff04d0c8d9d46060ea2c62900913
  • Pointer size: 132 Bytes
  • Size of remote file: 2.16 MB