Skip to content

Instantly share code, notes, and snippets.

@srmsoumya
srmsoumya / inference.ipynb
Created January 14, 2022 08:13
Inference script of TF segmentation model
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@srmsoumya
srmsoumya / 2022-02-07_cmr-stac-api.ipynb
Last active May 28, 2024 12:59
# Create Monthly NDVI composites using Harmonized Landsat Sentinel (HLS) data from NASA CMR STAC api using `pystac_client` & `stackstac`
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@srmsoumya
srmsoumya / timeseries-lulc-model.py
Created June 30, 2023 10:15
Model code for time series LULC classification.
import torch
import torch.nn as nn
import torch.nn.functional as F
def _conv(ni, nf, ks):
return nn.Conv1d(ni, nf, kernel_size=ks, stride=1, padding=ks // 2)
def _conv_layer(ni, nf, ks, drop=0.0):
@srmsoumya
srmsoumya / net.py
Created April 24, 2024 10:50
Simple Lightning trainer
import os
import torch
from torch import nn
from torch.utils.data import DataLoader, TensorDataset
import lightning as L
# Generate a synthetic dataset
def generate_data(num_samples):
# Generate random integers
@srmsoumya
srmsoumya / inference.py
Created May 16, 2024 12:18
Embeddings from Prithvi 100M NASA/IBM
import yaml
import numpy as np
import rasterio as rio
import torch
from prithvi import MaskedAutoencoderViT
from huggingface_hub import hf_hub_download
# Constants
REPO_ID = "ibm-nasa-geospatial/Prithvi-100M"
CONFIG = "Prithvi_100M_config.yaml"