weecology / NeonTreeEvaluation

Benchmark dataset for tree detection for airborne RGB, Hyperspectral and LIDAR imagery
Creative Commons Zero v1.0 Universal
133 stars 23 forks source link

duplicated annotation in plot BLAN_005_2019 #32

Closed Lenostatos closed 3 years ago

Lenostatos commented 3 years ago

Dear Mr. Weinstein,

by pure chance I found a duplicated bounding box in the annotations of plot BLAN_005_2019:

https://github.com/weecology/NeonTreeEvaluation/blob/d0b90bc75dd2f85939edccdd10c1eccd23c1a93e/annotations/BLAN_005_2019.xml#L49-L74

I wrote some code to check whether there are other duplicated annotations but found none:

library(tidyverse)

res <- map_dfr(
  list.files("../../RPackages/NeonTreeEvaluation/annotations", full.names = TRUE),
  function(annotation_file_path) {

    tibble(
      name = basename(annotation_file_path),
      any_duplicated =
        # get the bounding box data as a data.frame
        annotation_file_path %>%
        NeonTreeEvaluation::xml_parse() %>%
        # create a bounding box polygon from each row
        rowwise() %>%
        transmute(
          bounding_box = matrix(
            c(
              xmin, ymin,
              xmin, ymax,
              xmax, ymax,
              xmax, ymin,
              xmin, ymin
            ),
            ncol = 2,
            byrow = TRUE
          ) %>%
            # sf::st_polygon needs the coordinate matrix to be in a list
            list() %>%
            sf::st_polygon() %>%
            # put the polygon itself into a list so that in the end a list column of
            # polygons is created
            list()
        ) %>%
        # create an sf object from the polygons
        sf::st_sf() %>%
        ungroup() %>%
        duplicated() %>%
        any()
    )
  }
)

res %>% filter(any_duplicated)
#> # A tibble: 1 x 2
#>   name              any_duplicated
#>   <chr>             <lgl>         
#> 1 BLAN_005_2019.xml TRUE

Created on 2021-05-18 by the reprex package (v2.0.0)

bw4sz commented 3 years ago

I'm really enjoying these issues. You can totally call me Ben by the way. I wish all users were as thorough and useful as you've been today. Can I ask to hear more about your end goal?

On Tue, May 18, 2021 at 2:09 PM Leon @.***> wrote:

Dear Mr. Weinstein,

by pure chance I found a duplicated bounding box in the annotations of plot BLAN_005_2019:

https://github.com/weecology/NeonTreeEvaluation/blob/d0b90bc75dd2f85939edccdd10c1eccd23c1a93e/annotations/BLAN_005_2019.xml#L49-L74

I wrote some code to check whether there are other duplicated annotations but found none:

library(tidyverse) res <- map_dfr( list.files("../../RPackages/NeonTreeEvaluation/annotations", full.names = TRUE), function(annotation_file_path) {

tibble(
  name = basename(annotation_file_path),
  any_duplicated =
    # get the bounding box data as a data.frame
    annotation_file_path %>%
    NeonTreeEvaluation::xml_parse() %>%
    # create a bounding box polygon from each row
    rowwise() %>%
    transmute(
      bounding_box = matrix(
        c(
          xmin, ymin,
          xmin, ymax,
          xmax, ymax,
          xmax, ymin,
          xmin, ymin
        ),
        ncol = 2,
        byrow = TRUE
      ) %>%
        # sf::st_polygon needs the coordinate matrix to be in a list
        list() %>%
        sf::st_polygon() %>%
        # put the polygon itself into a list so that in the end a list column of
        # polygons is created
        list()
    ) %>%
    # create an sf object from the polygons
    sf::st_sf() %>%
    ungroup() %>%
    duplicated() %>%
    any()
)

} ) res %>% filter(any_duplicated)#> # A tibble: 1 x 2#> name any_duplicated#> #> 1 BLAN_005_2019.xml TRUE

Created on 2021-05-18 by the reprex package https://reprex.tidyverse.org (v2.0.0)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/weecology/NeonTreeEvaluation/issues/32, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJHBLDFL22XGCATRZW3D53TOLJSFANCNFSM45DJ4JQQ .

-- Ben Weinstein, Ph.D. Postdoctoral Fellow University of Florida http://benweinstein.weebly.com/

Lenostatos commented 3 years ago

I'm glad I can be of help :)

My goal is to evaluate a tree segmentation algorithm that I had been working on in my Master's Thesis. I'm using your package and data as a benchmark while experimenting with different parameters.