Skip to content

Instantly share code, notes, and snippets.

package main
import (
"context"
"fmt"
"log"
"os"
"strings"
"github.com/aws/aws-lambda-go/lambda"
@mexicantexan
mexicantexan / create_coco_annotations.py
Last active February 8, 2023 14:19
Create COCO Annotations from existing dataset to work with MMDetection
# Adapted from https://www.immersivelimit.com/tutorials/create-coco-annotations-from-scratch/#create-custom-coco-dataset
# Aimed at solving problem for: https://mmdetection.readthedocs.io/en/v2.25.0/tutorials/customize_dataset.html
# haven't tested script with multi-category, only tested with binary classification
import json
import numpy as np
from skimage import measure # (pip install scikit-image)
from shapely.geometry import Polygon, MultiPolygon # (pip install Shapely)
from PIL import Image # (pip install Pillow)
import os
@mexicantexan
mexicantexan / limit_keras_gpu_mem.py
Last active February 8, 2023 01:35
Limit Keras GPU Memory with Tensorflow v2
"""
For TensorFlow v2 and Keras you can limit gpu memory usage a couple of different ways, just add one of the following early on in your scripts
"""
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(physical_devices[0], True)
"""
or