added more examples and better description
Browse files- app.py +39 -11
- data/google_maps_queries/Bratislava_query_image.png +3 -0
- data/google_maps_queries/Bucharest_query_image.png +3 -0
- data/google_maps_queries/Everest_query_image.png +3 -0
- data/google_maps_queries/Galapagos Tilted_ query_image.png +3 -0
- data/google_maps_queries/Grand Canyon_query_image.png +3 -0
- data/google_maps_queries/Hokkaido_query_image.png +3 -0
- data/google_maps_queries/Peru_query_google_maps.png +3 -0
- data/google_maps_queries/Taipei_query_image.png +3 -0
- data/google_maps_queries/Tokyo_query_image.png +3 -0
- data/google_maps_queries/Warszawa_query_image.png +3 -0
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 =
|
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 |
-
-
|
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
|
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.
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
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
|
data/google_maps_queries/Bucharest_query_image.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Everest_query_image.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Galapagos Tilted_ query_image.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Grand Canyon_query_image.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Hokkaido_query_image.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Peru_query_google_maps.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Taipei_query_image.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Tokyo_query_image.png
ADDED
![]() |
Git LFS Details
|
data/google_maps_queries/Warszawa_query_image.png
ADDED
![]() |
Git LFS Details
|