Skip to content

Instantly share code, notes, and snippets.

View jeasinema's full-sized avatar
💭
I may be slow to respond.

Xiaojian Ma jeasinema

💭
I may be slow to respond.
View GitHub Profile
@jeasinema
jeasinema / pointnet.py
Created August 20, 2018 23:01
PointNet that supports arbitrary amount of points
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
class STN3d(nn.Module):
def __init__(self):
super(STN3d, self).__init__()
self.conv1 = torch.nn.Conv1d(3, 64, 1)
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : xyz2uvd.py
# Creation Date : 26-07-2018
# Created By : Jeasine Ma [jeasinema[at]gmail[dot]com]
from pyquaternion import Quaternion
import numpy as np
@jeasinema
jeasinema / neteasenews.py
Created June 13, 2018 12:30
Core script of an alfred workflow crawling news from 163.com
#! /usr/bin/env python
# coding=utf-8
__author__ = 'kingson_jeasinema'
import sys
import alfred
import requests
headers = {
@jeasinema
jeasinema / augmentations.py
Created June 4, 2018 13:27
Generic augmentation
import torch
from torchvision import transforms
import cv2
import numpy as np
import types
from numpy import random
def intersect(box_a, box_b):
max_xy = np.minimum(box_a[:, 2:], box_b[2:])
import os
import numpy as np
import h5py as h5
from scipy.misc import imread
from struct import pack, unpack
import IPython
import math
# Extract pointcloud from rgb-d, then convert it into obj coordinate system(tsdf/poisson reconstructed object)
# In fact, merged_cloud.ply is exactly composed by pointclouds that transformed into this coordinate system
@jeasinema
jeasinema / test_bn.py
Created May 28, 2018 02:14
Different behaviours of batch normalization
import numpy as np
def main_mxnet():
import mxnet as mx
from mxnet import gluon, autograd
from mxnet.gluon import nn
net = nn.Sequential()
with net.name_scope():
@jeasinema
jeasinema / split_image.py
Created May 9, 2018 13:08
An utils for draw split image
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : split_draw.py
# Purpose :
# Creation Date : 09-05-2018
# Last Modified : 2018年05月09日 星期三 21时06分55秒
# Created By : Jeasine Ma [jeasinema[at]gmail[dot]com]
import numpy as np
@jeasinema
jeasinema / pytorch-template.py
Last active November 14, 2018 22:30
A naive pytorch template
import argparse
import os
import time
import random
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset
@jeasinema
jeasinema / delaunay.py
Last active August 21, 2020 05:36
A python implementation of delaunay algorithm
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : face_morphing.py
# Creation Date : 04-04-2018
# Created By : Jeasine Ma [jeasinema[at]gmail[dot]com]
import cv2
import json
import numpy as np
@jeasinema
jeasinema / spatial_softmax.py
Last active March 10, 2023 08:11
Spatial(Arg)Softmax for pytorch
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'):
super(SpatialSoftmax, self).__init__()
self.data_format = data_format