Skip to content

Instantly share code, notes, and snippets.

@rasha-salim
Created February 7, 2021 08:45
Show Gist options
  • Save rasha-salim/d1e0c838bfdfbee144f3c5d48fe12dda to your computer and use it in GitHub Desktop.
Save rasha-salim/d1e0c838bfdfbee144f3c5d48fe12dda to your computer and use it in GitHub Desktop.
Createing Dataset object in activeloop hub
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
ds = Dataset(
tag,
shape=(2512,), # The size of our dataset
mode = "w",
schema = { # Here we'll define the structure of our data
"inputs": Tensor((256, 256, 4), dtype="float32"), # The input images (this is a tif image with 4 bands)
"rgb_inputs": Image(shape=(256, 256, 3), # The RGB version of our input
dtype="uint8"),
"masks": Segmentation(shape=(256, 256, 6), dtype="uint8") # The land cover segmentations
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment