Skip to content

Instantly share code, notes, and snippets.

Avatar

SgDylan Sg4Dylan

View GitHub Profile
View continual_learning_metric_calc.py
import csv
'''
suit for lifelong-robotic-vision/OpenLORIS-Object 's csv format result
every line of csv contains accuracy of every task on test set after training a single task
'''
raw_result = []
with open('openloris.csv', newline='') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
@Sg4Dylan
Sg4Dylan / GoHFS-Exporter.user.js
Created Oct 18, 2020
配合 codeskyblue/gohttpserver 使用,aria2 直接下载目录并保持结构
View GoHFS-Exporter.user.js
// ==UserScript==
// @name GoHFS-Exporter
// @namespace http://tampermonkey.net/
// @version 2020.10.18(0.1)
// @description Export link from Go HFS to aria2
// @author SgDylan
// @match https://example.com/*
// ==/UserScript==
let downloadFileUrl = [];
@Sg4Dylan
Sg4Dylan / font_deobfs.ipynb
Created Sep 28, 2020
对抗字体反爬的深度学习实践
View font_deobfs.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sg4Dylan
Sg4Dylan / dain_ncnn_vulkan_instance.ipynb
Last active Sep 8, 2020
dain-ncnn-vulkan@colaboratory
View dain_ncnn_vulkan_instance.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sg4Dylan
Sg4Dylan / qb-ban-vampire.py
Last active Aug 19, 2020
qBittorrent block vampire peers. qBittorrent 屏蔽吸血客户端.
View qb-ban-vampire.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Author: Sg4Dylan -- <sg4dylan#gmail.com>
# Licence: GPLv3
import requests
import re
import json
import time
@Sg4Dylan
Sg4Dylan / ascii2d_batch_match.py
Created Jul 19, 2020
使用 Ascii2D 批量匹配可能存在于 Pixiv 的 Twitter 图片
View ascii2d_batch_match.py
import os
import re
import json
import urllib
import requests
import wget
from tqdm import tqdm
from bs4 import BeautifulSoup
# 执行推理用
import numpy as np
@Sg4Dylan
Sg4Dylan / vmaf_for_image.py
Created Jun 7, 2020
使用 VMAF 测量图片质量
View vmaf_for_image.py
import os
import shutil
from PIL import Image
def check_size(image_a, image_b):
global i_size
w_a, h_a = Image.open(image_a).size
w_b, h_b = Image.open(image_b).size
if w_a == w_b and h_a == h_b:
@Sg4Dylan
Sg4Dylan / Lightpack.ino
Created Jun 6, 2020
Lightpack 开源破车
View Lightpack.ino
/*
* Arduino interface for the use of WS2812 strip LEDs
* Uses Adalight protocol and is compatible with Boblight, Prismatik etc...
* "Magic Word" for synchronisation is 'Ada' followed by LED High, Low and Checksum
* @author: Wifsimster <wifsimster@gmail.com>
* @library: FastLED v3.001
* @date: 11/22/2015
*/
#include <FastLED.h>
#define NUM_LEDS 50 // 设置灯珠总数(貌似不能超过 400 个
@Sg4Dylan
Sg4Dylan / opti.py
Last active Nov 24, 2020
Export ESRGAN model to ONNX format
View opti.py
import onnx
import onnxoptimizer as optimizer
onnxfile = 'ONNX_FILE_NAME'
onnx_model = onnx.load(f'{onnxfile}.onnx')
inputs = onnx_model.graph.input
name_to_input = {}
for input in inputs:
name_to_input[input.name] = input
@Sg4Dylan
Sg4Dylan / convert_model.bat
Created May 8, 2020
优化 PyTorch 输出 ONNX 模型并转换为 NCNN 模型
View convert_model.bat
@ECHO OFF & CD/D "%~dp0"
::save as CRLF/ANSI format
::usage: drag ONNX model to .bat to start processing
:start
IF "%~1"=="" GOTO :END
:proc
python -m onnxsim "%~nx1" "%~nx1.sim.onnx"
You can’t perform that action at this time.