Skip to content

Instantly share code, notes, and snippets.

View jinyu121's full-sized avatar
💪
Fighting!

Yu Hao jinyu121

💪
Fighting!
View GitHub Profile
@jinyu121
jinyu121 / README.md
Last active October 5, 2018 10:58
V2Ray backup

Backup a specific binary release version of V2Ray.

@jinyu121
jinyu121 / coco_to_voc.py
Last active April 27, 2023 02:26
Convert COCO to VOC
import json
import os
from tqdm import tqdm
from xmltodict import unparse
# BBOX_OFFSET: Switch between 0-based and 1-based bbox.
# The COCO dataset is in 0-based format, while the VOC dataset is 1-based.
# To keep 0-based, set it to 0. To convert to 1-based, set it to 1.
BBOX_OFFSET = 0
@jinyu121
jinyu121 / 01_face_dataset.py
Created June 1, 2018 02:32
OpenCV Face Recognition Demo
import cv2
cam = cv2.VideoCapture(0)
cam.set(3, 640) # set video width
cam.set(4, 480) # set video height
face_detector = cv2.CascadeClassifier('conf/haarcascade_frontalface_default.xml')
# For each person, enter one numeric face id
names_count = [x.strip() for x in open('conf/names.txt').readlines() if x.strip() != ""]
@jinyu121
jinyu121 / ss.py
Created April 15, 2018 11:34
Convert shadowsocks info to ss schema
import base64
server = "12.34.56.78"
port = "12345"
password = "Here is the password"
encrypt_method = "chacha20-ietf-poly1305"
s = "{}:{}".format(encrypt_method, password).encode()
print("ss://{}@{}:{}".format(base64.standard_b64encode(s).decode(), server, port))
@jinyu121
jinyu121 / vocmnist.py
Created April 11, 2018 12:38
Multi MNIST in VOC format
import torch
import torchvision
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
import numpy as np
import os
from tqdm import tqdm, trange
from skimage.io import imsave
from easydict import EasyDict
from copy import deepcopy
@jinyu121
jinyu121 / tmux.sh
Last active April 11, 2018 10:38
Install without sudo
#!/bin/bash
TMUX_VERSION="2.1"
LIBEVENT_VERSION="2.0.20"
NCURSES_VERSION="6.0"
# Set this flag to prevent errors
export CPPFLAGS="-P"
# Script for installing tmux on systems where you don't have root access.
@jinyu121
jinyu121 / README.md
Last active January 24, 2019 10:42
A `torch.utils.data.Dataset` for `pytorch-yolo`

A Dataset for yolo2-pytorch

Minimal code modify.

If you have any better code, please let me know~ THX!!!!!

Update

  • [20180426] The original code
  • [20180427] Simple multi thread
@jinyu121
jinyu121 / CustomTransport.py
Last active March 12, 2018 14:38
Resolve a problem in `wordpress_xmlrpc` package
from xmlrpc.client import Transport, GzipDecodedResponse
class CustomTransport(Transport):
def parse_response(self, response):
# Read response data from httpresponse, and parse it
# Check for new http response object, else it is a file object
if hasattr(response, 'getheader'):
if response.getheader("Content-Encoding", "") == "gzip":
stream = GzipDecodedResponse(response)
@jinyu121
jinyu121 / download_cut_face.py
Created March 8, 2018 08:28
Download and cut comic face
# -*- coding: utf-8 -*-
import time
import redis
import os
import cv2
from threading import Thread
import requests
from tqdm import tqdm
from bs4 import BeautifulSoup
@jinyu121
jinyu121 / demo_detector.c
Created February 6, 2018 13:01
Darknet Detection PR
void validate_detector_PRcurve(char *datacfg, char *cfgfile, char *weightfile)
{
list *options = read_data_cfg(datacfg);
char *valid_images = option_find_str(options, "valid", "data/voc.2007.test");
network net = parse_network_cfg(cfgfile);
if(weightfile){
load_weights(&net, weightfile);
}
set_batch_network(&net, 1);