Skip to content

Instantly share code, notes, and snippets.

View mkocabas's full-sized avatar

Muhammed Kocabas mkocabas

View GitHub Profile
#!/usr/bin/env bash
mkdir coco
cd coco/
wget http://images.cocodataset.org/zips/train2017.zip
wget http://images.cocodataset.org/zips/val2017.zip
unzip train2017.zip
unzip val2017.zip
import os
import subprocess
from multiprocessing import Process
NUM_PROCESS = 1 # define number of processes to speed up
VIDEOS_DIR = 'Videos' # path to Human3.6M videos
def find_files():
SUBJECTS = [1, 5, 6, 7, 8, 9, 11]
import dgl
import torch
import torch.nn as nn
def build_pose_graph():
g = dgl.DGLGraph()
g.add_nodes(16)
edge_list = [(0, 1), (1, 2), (2, 6), (6, 3), (3, 4),
import numpy as np
import json
import math
import matplotlib.pyplot as plt
def showAnns(jts):
# c = (np.random.random((1, 3)) * 0.6 + 0.4).tolist()[0]
c = [0.7, 0.9, 0.8]
import numpy as np
import cv2
import src.data_utils as data_utils
from src.data_utils import load_data, project_to_cameras
import os
import matplotlib.pyplot as plt
from src import cameras, viz
def drawlines(img1,img2,lines,pts1,pts2):
from __future__ import print_function
import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftArgmax(nn.Module):
def __init__(self):
super(SoftArgmax, self).__init__()
from __future__ import print_function, absolute_import
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
class FPN(nn.Module):
def __init__(self,
backbone='resnet50',
import torch
import torch.nn.functional as F
from torch.nn.parameter import Parameter
import numpy as np
class SpatialSoftmax(torch.nn.Module):
def __init__(self, height, width, channel, temperature=None, data_format='NCHW', unnorm=False):
super(SpatialSoftmax, self).__init__()
self.data_format = data_format
@mkocabas
mkocabas / nms_pytorch.py
Created June 1, 2018 04:56
Pytorch NMS implementation
import torch
# Original author: Francisco Massa:
# https://github.com/fmassa/object-detection.torch
# Ported to PyTorch by Max deGroot (02/01/2017)
def nms(boxes, scores, overlap=0.5, top_k=200):
"""Apply non-maximum suppression at test time to avoid detecting too many
overlapping bounding boxes for a given object.
Args:
boxes: (tensor) The location preds for the img, Shape: [num_priors,4].
from mininet.net import Mininet
from random import randint
from scipy import spatial
import numpy as np
import scipy as scp
import math
## Mininet must run as ROOT !!!
# add function for nodes to move randomly when invoked