This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torchvision | |
import os.path as osp | |
import numpy as np | |
import cv2 | |
import torch | |
import time | |
def get_video_opencv(fname): | |
vid_tensor = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]. |