Skip to content

Instantly share code, notes, and snippets.

View live-wire's full-sized avatar

Dhruv Batheja live-wire

View GitHub Profile
@live-wire
live-wire / main.py
Created March 22, 2018 18:46
EvalAI sample evaluation script for the VQA challenge
"""
Input: GT JSON file, Pred JSON file, Phase-CodeName
Hardcoded path of a split-JSON file which has the following structure
Split JSON File Structure -
{
split1 : [list of qids]
split2 : [list of qids]
split3 : [list of qids]
split4 : [list of qids]
@live-wire
live-wire / mnist.md
Last active April 6, 2018 13:17
MNIST Challenge creation for EvalAI

MNIST challenge creation for EvalAI

A tutorial on how I created the mnist-challenge

I started with going through this documentation about challenge creation. This involves creation of a yaml configuration file for the challenge.

Before we dive into the configuration, we need to establish a few things about the platform. Each challenge is split into phases decided by the host (us in this scenario). The host can have different dataset splits for different challenge phases. The host can set the visibility of the challenge phases and also of the leaderboards to HOST, OWNER & HOST or PUBLIC. The number and types of columns in the leaderboard is also configurable.

Configuration

Let me use the configuration I created for the challenge and go through it line by line:

@live-wire
live-wire / preparation.ipynb
Created March 25, 2018 04:55
MNIST challenge for EvalAI data preparation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@live-wire
live-wire / toc.py
Created August 29, 2018 19:15
Markdown Table of Contents Generator (Just add <toc> to your markdown and it will be replaced by the Table of contents when you run this script)
import re
import sys
stringtoreplace = "<toc>"
def generateTOC(filename):
contents = []
with open(filename, "r") as ins:
for line in ins:
from graphviz import Digraph
import torch
from torch.autograd import Variable, Function
def iter_graph(root, callback):
queue = [root]
seen = set()
while queue:
fn = queue.pop()
if fn in seen:
@live-wire
live-wire / videoflip.py
Created October 5, 2018 01:22
Video Reverse / Flip utility
# Video reverse
import imageio
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--video", help="file path of video to be reversed")
args = parser.parse_args()
def main():
@live-wire
live-wire / convert.py
Created September 10, 2019 21:28
JPEG-2000 to JPEG conversion using Python - PIL
# Expects jp2 files in folder jp2-files/
# jpeg files are generated in folder jpeg-files/
import os
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
input_folder = "jp2-files"
output_folder = "jpeg-files"
@live-wire
live-wire / spread.py
Last active October 3, 2019 16:01
Get coordinates of patches in an image (2D array)
# Suppose you have a black image with white spots
# This script will give you box coordinates of those spots
#
#
# live-wire.github.io
#
# We will look at the image from the bottom-left and spread outwards
# If a 1 is encountered, the algorithm will try to spread in all directions from that cell.
# See functions possible_moves, possible_moves_exhaustive
@live-wire
live-wire / statefulset.yaml
Created May 31, 2022 10:20
sample statefulset
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: ephemeral-test-statefulset
namespace: test-namespace
spec:
replicas: 600
serviceName: ephemeral-test-statefulset
podManagementPolicy: Parallel
selector:
@live-wire
live-wire / deployment.yaml
Created May 31, 2022 10:21
sample deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: ephemeral-test-deployment
namespace: test-namespace
spec:
replicas: 600
selector:
matchLabels:
app: ephemeral-test-deployment