This file contains hidden or 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
import rasterio | |
from rasterio import features | |
from rasterio.io import MemoryFile | |
import math | |
import geopandas as gpd | |
import os | |
w = 400 | |
h = 400 |
This file contains hidden or 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 getGeojson(): | |
# Store the mask coordinates into a geojson file | |
bounds = getImgBounds() | |
dataset = rasterio.open(png_path) | |
bands = [1] | |
data = dataset.read(bands) | |
transform = rasterio.transform.from_bounds(bounds[0], bounds[1], bounds[2], bounds[3], data.shape[1], data.shape[2]) | |
crs = rasterio.crs.CRS({"init": "epsg:4326"}) # 3857 Google Maps Projection 4326 World wide (3D) | |
with MemoryFile() as memfile: | |
meta = {"count": 1, "width": data.shape[1], "height": data.shape[2], "transform": transform, "nodata": 0, "crs": crs, "dtype":data.dtype} |
This file contains hidden or 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 getGeojson(): | |
# Store the mask coordinates into a geojson file | |
bounds = getImgBounds() | |
dataset = rasterio.open(png_path) | |
bands = [1] | |
data = dataset.read(bands) | |
transform = rasterio.transform.from_bounds(bounds[0], bounds[1], bounds[2], bounds[3], data.shape[1], data.shape[2]) | |
crs = rasterio.crs.CRS({"init": "epsg:4326"}) # 3857 Google Maps Projection 4326 World wide (3D) | |
with MemoryFile() as memfile: | |
meta = {"count": 1, "width": data.shape[1], "height": data.shape[2], "transform": transform, "nodata": 0, "crs": crs, "dtype":data.dtype} |
This file contains hidden or 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
import os | |
import math | |
import rasterio | |
from rasterio import features | |
# Specify the image parameters | |
w = 400 | |
h = 400 | |
zoom = 8 | |
lat = -19.361500892883598 |
This file contains hidden or 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
# I just extracted the input, rgb, and segmentation to separate arrays for convenience | |
inputs = [] | |
masks = [] | |
rgb_inputs = [] | |
for pairs in images_target: | |
inputs.append(pairs['input']) | |
masks.append(pairs['mask']) | |
rgb_inputs.append(pairs['input_rgb']) | |
# Pass the data to our Dataset instance we created earlier |
This file contains hidden or 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
inputs_dir = '/content/landcovernet/inputs' # The directory where our input resides | |
targets_dir = '/content/landcovernet/targets' # The directory where our target resides | |
# First stack all the bands togather | |
def process_tiffs(inputs_dir, target_dir): | |
data = [] | |
sub_dir_list = [] | |
images_target = {} | |
stacked_imgs = [] | |
list_bands = [] |
This file contains hidden or 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
inputs_dir = '/content/landcovernet/inputs' # The directory where our input resides | |
targets_dir = '/content/landcovernet/targets' # The directory where our target resides | |
# First stack all the bands togather | |
def process_tiffs(inputs_dir, target_dir): | |
data = [] | |
sub_dir_list = [] | |
images_target = {} | |
stacked_imgs = [] | |
list_bands = [] |
This file contains hidden or 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
inputs_dir = '/content/landcovernet/inputs' # The directory where our input resides | |
targets_dir = '/content/landcovernet/targets' # The directory where our target resides | |
# First stack all the bands togather | |
def process_tiffs(inputs_dir, target_dir): | |
data = [] | |
sub_dir_list = [] | |
images_target = {} | |
stacked_imgs = [] | |
list_bands = [] |
This file contains hidden or 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
import hub | |
from hub.schema import Image | |
from hub.schema import Tensor | |
from hub.schema import Mask | |
from hub.schema import Segmentation | |
# include your user anme and a name for your dataset | |
tag = "rasha/landCoverNet_Omdena_Sample" | |
ds = {} | |
# Define youe dataset object |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder