Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import os
import time
import logging
import argparse
import tensorrt as trt
import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np
from cuda import cudart
#!/usr/bin/env python
import os
from super_gradients.training import models
from super_gradients.common.object_names import Models
import onnx
import torch
import torch.nn as nn
# CONFIG
@LukeAI
LukeAI / batch_sam.py
Last active July 9, 2023 08:05
How to process a dir of images with SAM and save visualisations of their masks
#!/usr/bin/env python
from __future__ import annotations
import os
from pathlib import Path
from segment_anything import sam_model_registry, SamAutomaticMaskGenerator, SamPredictor
import cv2
import numpy as np
import torch
from tqdm import tqdm