This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def select_best_pair(self): | |
""" | |
Select two individuals from the population randomly, where the probability of choosing an individual | |
is weighted by it's fitness level. | |
:return: two selected individuals | |
""" | |
pop_fitness_list = np.array([ind.fitness for ind in self.population]) | |
pop_fitness_list = -pop_fitness_list + np.min(pop_fitness_list) + np.max(pop_fitness_list) + 1 | |
pop_fitness_list = pop_fitness_list / np.sum(pop_fitness_list) | |
p1, p2 = np.random.choice(self.population, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for idx, c in enumerate(chromosome): | |
if np.random.rand() < mutation_probability: | |
has_mutated = True | |
rand_idx = np.random.choice(range(len(chromosome))) | |
chromosome[idx], chromosome[rand_idx] = chromosome[rand_idx], chromosome[idx] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_unique_orientations(poly): | |
""" | |
Out of all possible rotations and flips, take into account the polygon symmetry and | |
obtain the unique polygon orientations. | |
:param poly: input polygon | |
:return: array of unique settings of (rotation, flip) | |
""" | |
cx, cy = poly.centroid.x, poly.centroid.y | |
pts = np.array(poly.checkers)[:, :-1] | |
checkers = np.array(poly.checkers)[:, -1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() { | |
return { | |
input: ["sunZenithAngles", "sunAzimuthAngles"], | |
mosaicking: Mosaicking.ORBIT, | |
output: { id:"default", bands: 0} | |
} | |
} | |
function updateOutputMetadata(scenes, inputMetadata, outputMetadata) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
download_task = SentinelHubInputTask( | |
bands_feature=(FeatureType.DATA, 'RGB'), | |
bands = ['B04', 'B03', 'B02'], | |
resolution=10, | |
maxcc=1.0, | |
time_difference=timedelta(hours=2), | |
data_source=DataSource.SENTINEL2_L2A, | |
max_threads=10, | |
additional_data=[ | |
(FeatureType.MASK, 'dataMask'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eopatch.timestamp | |
eopatch.mask['LULC'] | |
eopatch.data['CLM'][0] | |
eopatch.data['BANDS'][5][..., [3, 2, 1]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EOPatch( | |
data: { | |
BANDS: numpy.ndarray(shape=(80, 1010, 999, 6), dtype=float32) | |
} | |
mask: { | |
CLM: numpy.ndarray(shape=(80, 1010, 999, 1), dtype=uint8) | |
IS_DATA: numpy.ndarray(shape=(80, 1010, 999, 1), dtype=uint8) | |
IS_VALID: numpy.ndarray(shape=(80, 1010, 999, 1), dtype=bool) | |
} | |
mask_timeless: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load EOPatch | |
EOPatch.load('path_to_eopatches/eopatch-0x6/') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model | Overall Accuracy [%] | F_1 Score [%] | |
---|---|---|---|
Uniform at 16-day rate | 94.4 | 94.1 | |
Uniform at 8-day rate | 94.5 | 94.3 | |
Optimally selected | 94.6 | 94.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Model | Overall Accuracy [%] | F_1 Score [%] | |
---|---|---|---|
No filtering/no masking | 92.8 | 92.6 | |
No filtering/with masking | 94.2 | 93.9 | |
With filtering/no masking | 94.0 | 93.8 | |
With filtering/with masking | 94.4 | 94.1 |