Skip to content

Instantly share code, notes, and snippets.

@thomasweng15
thomasweng15 / publish_eye_on_hand.py
Created Jun 4, 2021
publish calibration transform
View publish_eye_on_hand.py
#!/usr/bin/env python
import rospy
import numpy as np
import copy
import tf
import tf.transformations as tfs
import geometry_msgs.msg
from easy_handeye.handeye_calibration import HandeyeCalibration
View resnet.py
import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
import numpy as np
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152']
@thomasweng15
thomasweng15 / resnet.py
Created Aug 24, 2020
resnet with multigrid
View resnet.py
class ResNet(nn.Module):
def __init__(self,
block,
layers,
num_classes=1000,
fully_conv=False,
remove_avg_pool_layer=False,
output_stride=32,
additional_blocks=0,
multi_grid=(1,1,1) ):
View data_loader_ft.py
# -*- coding: utf-8 -*-
from __future__ import print_function
from matplotlib import pyplot as plt
from PIL import Image
import numpy as np
import random
import os
import cv2
@thomasweng15
thomasweng15 / plots.py
Created Jan 23, 2020
Plots for peg insertion project
View plots.py
import seaborn as sns; sns.set()
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def plot(run_IDs, run_labels, factors, titles,
colors=['steelblue', 'orange', 'mediumseagreen', 'red', 'purple'],
ecolors=['lightblue', 'navajowhite', 'lightgreen', 'pink', 'plum'],
dpi=150):
csv_names = ['run_%d/progress.csv' % i for i in run_IDs]
@thomasweng15
thomasweng15 / test_cartesian.py
Created Jan 17, 2020
Sawyer cartesian control
View test_cartesian.py
#!/usr/bin/env python
import rospy
import numpy as np
import moveit_commander
import intera_interface
from copy import deepcopy
from geometry_msgs.msg import Pose
import sys
from visual_mpc.envs.robot_envs.sawyer.sawyer_impedance import SawyerImpedanceController
from visualization_msgs.msg import Marker
@thomasweng15
thomasweng15 / train.sh
Last active Mar 29, 2019
Bash script for running sbatch
View train.sh
#!/usr/bin/env bash
#SBATCH --nodes=1
#SBATCH --partition=GPU
#SBATCH --ntasks-per-node=1
#SBATCH --time=96:00:00
#SBATCH --gres=gpu:1
#SBATCH --mem=8G
#SBATCH --exclude=compute-0-[9,11,13]
#SBATCH -o /home/USER/out.txt
#SBATCH -e /home/USER/out.txt
View save_rgbd.py
import rospy
import sys
from sensor_msgs.msg import Image
import pprint
import cv2
from cv_bridge import CvBridge
import tf
import time
global saved_RGB
@thomasweng15
thomasweng15 / example.py
Last active Mar 16, 2019
5-minute guide to Python debugging with Visual Studio Code
View example.py
a = 1
b = 2
c = a + b
View open efort depth img.py
import numpy as np
import matplotlib.pyplot as plt
import cv2
im = cv2.imread("2019-02-13-19-03-1912345DepthImage.png", cv2.IMREAD_UNCHANGED)
color_im = cv2.applyColorMap(im.astype(np.uint8), cv2.COLORMAP_JET)
plt.imshow(color_im)
plt.show()