Skip to content
Snippets Groups Projects
Commit 1beaf69b authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Moved accuracy function to utils.py

parent 72f7d01d
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ import datetime
# externals
import gdal
import torch
import numpy as np
# the following functions are utility functions for common image
......@@ -296,6 +297,14 @@ def reconstruct_scene(tiles, img_size, tile_size=None, nbands=1):
return scene.squeeze()
# function calculating prediction accuracy
def accuracy_function(outputs, labels):
if isinstance(outputs, torch.Tensor):
return (outputs == labels).float().mean().item()
else:
return (np.asarray(outputs) == np.asarray(labels)).mean().item()
def parse_landsat_scene(scene_id):
# Landsat Collection 1 naming convention in regular expression
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment