Skip to content

Instantly share code, notes, and snippets.

View zeyuyun1's full-sized avatar

Zeyu Yun zeyuyun1

  • UC Berkeley
  • Berkeley
View GitHub Profile
@nirshlezinger1
nirshlezinger1 / lista-vs-ista.ipynb
Created May 4, 2022 07:58
LISTA vs ISTA.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pjessesco
pjessesco / image_viewer.py
Created February 15, 2021 08:28
Python full-screen image viewer using PyQT5, without white board which appears in `cv2.imshow()`
# Reference : https://stackoverflow.com/a/59539843
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import QObject, pyqtSignal
import sys
import time
import threading
@sgraaf
sgraaf / ddp_example.py
Last active April 23, 2024 11:13
PyTorch Distributed Data Parallel (DDP) example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from argparse import ArgumentParser
import torch
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
from torch.utils.data import DataLoader, Dataset
from torch.utils.data.distributed import DistributedSampler
from transformers import BertForMaskedLM
import torch
import torch.nn.functional as F
from torchvision.datasets import MNIST
from torchvision.transforms import ToTensor
from torch.utils.data import DataLoader
from torch_geometric.utils import grid
from torch_geometric.nn import SplineConv
train_dataset = MNIST('/tmp/MNIST', train=True, transform=ToTensor())
@anastasiia-kornilova
anastasiia-kornilova / gaussFilter1d.java
Created July 15, 2018 16:13
This is the simplest implementation of gaussian_filter1d from Python scipy library.
import static java.lang.Math.*;
public class GaussSmooth {
private static double gauss(double sigma, double x) {
double expVal = -0.5 * (pow(x, 2) / pow(sigma, 2));
return exp(expVal);
}
private static double[] gaussKernel1d(double sigma, int lw) {
@jin-zhe
jin-zhe / actionrecognitiondatasets.md
Last active March 18, 2024 23:47
An overview of action recognition datasets and their detection classes

Activity Recognition Datasets

An overview of recent action recognition datasets and their detection classes

Concepts & terminologies:

  • Action: Atomic low-level movement such as standing up, sitting down, walking, talking etc.
  • Activity/event: Higher level occurence then actions such as dining, playing, dancing
  • Trimmed video: A short video clip containing event/action/activity of interest
  • Untrimmed video: A video clip of arbitrary length potentially containing durations without activities of interest
  • Localization: locating an instance of event/action/activity within a video at a spatial or temporal scale
  • Spatial localization: Locating the region/area of an instance of action/activity within a video
#!/usr/bin/env python3
import numpy as np
import gym
from baselines.common.vec_env.subproc_vec_env import SubprocVecEnv
env_name = 'Pendulum-v0'
nproc = 8
T = 10
@arose13
arose13 / install-conda.sh
Last active February 18, 2024 12:20
Install Miniconda in Ubuntu
# Setup Ubuntu
sudo apt update --yes
sudo apt upgrade --yes
# Get Miniconda and make it the main Python interpreter
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p ~/miniconda
rm ~/miniconda.sh
export PATH=~/miniconda/bin:$PATH
@tehmas
tehmas / client.py
Created December 4, 2016 16:55
Sending OpenCV frames using Python TCP sockets
import cv2
import cPickle
import socket
import struct
TCP_IP = '127.0.0.1'
TCP_PORT = 9501
server_address = (TCP_IP, TCP_PORT)
i = 0