From 542192aa9e7448c03a086fc548ec03c8a232f124 Mon Sep 17 00:00:00 2001 From: Felipe Date: Sat, 7 Dec 2024 20:03:21 +0000 Subject: [PATCH 1/5] fix bug in time series classification images --- R/api_classify.R | 4 ++++ R/api_ml_model.R | 2 ++ R/sits_classify.R | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/R/api_classify.R b/R/api_classify.R index 5762c5f5..86f7b570 100755 --- a/R/api_classify.R +++ b/R/api_classify.R @@ -651,6 +651,8 @@ values <- .pred_features(pred_part) # Classify values <- ml_model(values) + # normalize and calibrate values + values <- .ml_normalize(ml_model, values) # Return classification values <- tibble::as_tibble(values) values @@ -691,6 +693,8 @@ values <- .pred_features(pred_part) # Classify values <- ml_model(values) + # normalize and calibrate values + values <- .ml_normalize(ml_model, values) # Return classification values <- tibble::tibble(data.frame(values)) # Clean GPU memory diff --git a/R/api_ml_model.R b/R/api_ml_model.R index 3d4df02b..d480f964 100644 --- a/R/api_ml_model.R +++ b/R/api_ml_model.R @@ -119,8 +119,10 @@ #' @export #' .ml_normalize.torch_model <- function(ml_model, values){ + column_names <- colnames(values) values[is.na(values)] <- 0 values <- softmax(values) + colnames(values) <- column_names return(values) } #' @export diff --git a/R/sits_classify.R b/R/sits_classify.R index ee603458..fd712ec6 100644 --- a/R/sits_classify.R +++ b/R/sits_classify.R @@ -437,7 +437,7 @@ sits_classify.segs_cube <- function(data, proc_bloat <- .conf("processing_bloat_gpu") } # avoid memory race in Apple MPS - if(.torch_mps_enabled(ml_model)){ + if (.torch_mps_enabled(ml_model)) { memsize <- 1 gpu_memory <- 1 } From 699baf0894ce33aed9e792f7cfd0b409468f4e62 Mon Sep 17 00:00:00 2001 From: Felipe Date: Sat, 7 Dec 2024 21:56:08 +0000 Subject: [PATCH 2/5] update .tile_extract message --- R/api_tile.R | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/api_tile.R b/R/api_tile.R index df41654f..26fe7e4b 100644 --- a/R/api_tile.R +++ b/R/api_tile.R @@ -1465,7 +1465,8 @@ NULL x = r_obj, y = segments, fun = NULL, - include_cols = "pol_id" + include_cols = "pol_id", + progress = FALSE ) values <- dplyr::bind_rows(values) values <- dplyr::select(values, -"coverage_fraction") From e39ae1359aed141cf136893ead69e6a483541fb5 Mon Sep 17 00:00:00 2001 From: Felipe Date: Mon, 9 Dec 2024 19:24:46 +0000 Subject: [PATCH 3/5] add FLT8S metadata --- inst/extdata/config_internals.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inst/extdata/config_internals.yml b/inst/extdata/config_internals.yml index 3da8d367..bc4a603c 100644 --- a/inst/extdata/config_internals.yml +++ b/inst/extdata/config_internals.yml @@ -125,6 +125,13 @@ default_values : maximum_value: 1.7014118346015974e+37 offset_value : 0 scale_factor : 1 + FLT8S : + data_type : "FLT8S" + missing_value: -3.402823466385288e+37 + minimum_value: -3.402823466385288e+37 + maximum_value: 1.7014118346015974e+37 + offset_value : 0 + scale_factor : 1 # Derived cube definitions derived_cube : From ae2e0eac005f1d81a5223c42536474ee773ba193 Mon Sep 17 00:00:00 2001 From: Felipe Date: Wed, 11 Dec 2024 20:33:51 +0000 Subject: [PATCH 4/5] fix bug in classify label's name with space --- R/api_classify.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/api_classify.R b/R/api_classify.R index 86f7b570..a7a4647e 100755 --- a/R/api_classify.R +++ b/R/api_classify.R @@ -596,7 +596,8 @@ prediction <- .classify_ts_gpu( pred = pred, ml_model = ml_model, - gpu_memory = gpu_memory) + gpu_memory = gpu_memory + ) else prediction <- .classify_ts_cpu( pred = pred, @@ -696,7 +697,7 @@ # normalize and calibrate values values <- .ml_normalize(ml_model, values) # Return classification - values <- tibble::tibble(data.frame(values)) + values <- tibble::as_tibble(values) # Clean GPU memory .ml_gpu_clean(ml_model) return(values) From ef975f0d4672c5d0a8fe4bfd79839d103c366456 Mon Sep 17 00:00:00 2001 From: Felipe Carvalho Date: Thu, 12 Dec 2024 16:54:16 +0000 Subject: [PATCH 5/5] fix bug in plot segment with RGB --- R/sits_plot.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/sits_plot.R b/R/sits_plot.R index dcfae4a2..4bcf0b8a 100644 --- a/R/sits_plot.R +++ b/R/sits_plot.R @@ -836,6 +836,8 @@ plot.vector_cube <- function(x, ..., sf_seg = sf_seg, seg_color = seg_color, line_width = line_width, + first_quantile = first_quantile, + last_quantile = last_quantile, scale = scale, max_cog_size = max_cog_size, tmap_params = tmap_params