Rob174 / detection_nappe_hydrocarbures_IMT_cefrem

0 stars 0 forks source link

filtered_cache_images.hdf5 training not working #29

Closed Rob174 closed 3 years ago

Rob174 commented 3 years ago

Context

Dataset with patches

Problem

image

➡️ Model converges

But unsatisfactory result

Prediction

2021-07-12_11h01min03s__027481_0319CB_0EB7_it_11562_epoch_69_rgb_overlay_pred

Compared to the reference

2021-07-12_11h01min03s__027481_0319CB_0EB7_it_11562_epoch_69_rgb_overlay_true

➡️ 2 problems:

Diagnosis

Statistics of number of classes present on patches

Compared with original polygons statistics

To get them we have used

  1. the DB Manager to execute SQL queries to get a. the number of rasters with each amount of seep possible b. the number of rasters with each amount of spill possible
  2. a python script to merge the two tables (gotten with copy paste) and count the number of raster with each amount of seep and spill possible
Number of seep Number of spill Number of raster Number of seep Number of spill Number of raster
0 0 357 2 0 4
0 1 10 2 1 1
0 2 11 2 5 1
0 3 10 2 8 1
0 4 5 20 0 2
0 5 2 3 0 9
0 6 3 3 1 1
0 7 1 3 3 1
0 9 1 4 0 9
1 0 11 4 3 1
1 3 2 5 0 6
1 6 1 5 1 2
1 7 1 5 2 1
10 0 2 6 0 3
11 0 3 6 2 2
11 4 1 7 0 5
12 0 1 8 0 3
13 0 1 8 1 1
14 7 1 8 2 1
15 0 2 8 7 1
15 1 1 9 0 2

image (with 0,0 point excluded) Interactive vizualization

Rob174 commented 3 years ago

Conclusions : cause of the problem

not given to the model ➡️ understandable that the model does not well on these patches

According to Statistics of number of classes present on patches, there are less patches with spill maybe due to the fact that several spill polygons can be on the same image

But according to Compared with original polygons statistics, there are 196 spill and 533 seep on all rasters

➡️this issue will be treated in issue 32

Rob174 commented 3 years ago

Second cause of problems

Interpolation on labels cause class shifts:

On this image at the origin there was probably only the brightest class of value 2, but with interpolation (due to augmentations), the class 1 has been added

image image

➡️ This problem will be treated in issue 31

Rob174 commented 3 years ago

Only 4 interpolation methods allowed for warpAffine image

Rob174 commented 3 years ago

Algo 1 : do not work

We observe on an example that we can bound number of intermediate pixels with artificial values generated around real value pixels.

Potential solution: Step 1: warpAffine Step 2: convert to uint8 Step 3: maxpooling with a kernel of more than the number of pixels

image image (kernel 5) image image (kernel 10) image image (kernel 3)

Rob174 commented 3 years ago

Algo 2:

  1. Gaussian blur
  2. Subtract it from the original image

Filtered because delete all labels

Rob174 commented 3 years ago

Slow solution but add precision

Create the augmented patch directly with points of annotations

Done in 3636648

Rob174 commented 3 years ago
After computing another time the classes stats on the new filtered cache we observe a more balanced dataset regarding seep and spill classes repartition: seep_only spill_only seep_spill
11766 9258 208
55 % 44 % 0.98 %