This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 每60分钟自动运行代码刷新,解除90分钟断开限制. | |
// 使用方法:colab页面按下 F12或者 Ctrl+Shift+I (mac按 Option+Command+I) 在console(控制台) 输入以下代码并回车. | |
// 复制以下代码粘贴在浏览器console!!不要关闭浏览器以免失效 | |
function ConnectButton(){ | |
console.log("Connect pushed"); | |
document.querySelector("#connect").click() | |
} | |
setInterval(ConnectButton,60000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import rawpy | |
def pack_raw(raw): | |
im = raw.raw_image_visible.astype(np.float32) | |
im = np.expand_dims(im, axis=2) | |
img_shape = im.shape | |
H = img_shape[0] | |
W = img_shape[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import cv2 | |
import numpy as np | |
from tqdm import tqdm | |
import argparse | |
from facenet_pytorch import MTCNN | |
mtcnn = MTCNN(select_largest=True, min_face_size=64, post_process=False, device='cuda:0') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py | |
python3 get-pip.py | |
echo 'export PATH="$PATH:/home/Yanwei_Liu/.local/bin"' >> ~/.bashrc | |
echo 'alias python=python3' >> ~/.bashrc | |
source ~/.bashrc | |
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 | |
pip install -r requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
urls = "https://drive.google.com/file/d/FILEID_1/view?usp=drive_link, https://drive.google.com/file/d/FILEID_2/view?usp=drive_link, https://drive.google.com/file/d/FILEID_3/view?usp=drive_link" | |
url_list = urls.split(', ') | |
pat = re.compile('https://drive.google.com/file/d/(.*)/view\?usp=drive_link') | |
for idx, url in enumerate(url_list): | |
g = pat.match(url) | |
id = g.group(1) | |
down_url = f'https://drive.google.com/uc?id={id}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Firebase是可以即時讀取的資料庫,主要以JSON格式為主。除了透過程式操作外,也能在Firebase的網頁界面上進行資料操作(上傳、讀取、修改、刪除) | |
''' | |
###程式1### | |
#引入模組 | |
from firebase import firebase | |
import time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://github.com/d246810g2000/YOLOX/blob/main/datasets/train_val_data_split_coco.py | |
""" | |
import os | |
import cv2 | |
import json | |
import random | |
import shutil | |
import xml.etree.ElementTree as ET | |
from tqdm import tqdm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def resume_train(self, model): | |
if self.args.resume: | |
logger.info("resume training") | |
if self.args.ckpt is None: | |
ckpt_file = os.path.join(self.file_name, "latest" + "_ckpt.pth") | |
else: | |
ckpt_file = self.args.ckpt | |
ckpt = torch.load(ckpt_file, map_location=self.device) | |
# resume the model/optimizer state dict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _cache_images(self): | |
logger.warning("\n********************************************************************************\n" | |
"You are using cached images in RAM to accelerate training.\n" | |
"This requires large system RAM.\n" | |
"Make sure you have 200G+ RAM and 136G available disk space for training COCO.\n" | |
"********************************************************************************\n") | |
max_h = self.img_size[0] | |
max_w = self.img_size[1] | |
cache_file = self.data_dir + "/img_resized_cache_" + self.name + ".array" | |
if not os.path.exists(cache_file): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
https://github.com/z-bingo/FastDVDNet/tree/master/arch | |
Reimplementation of 4 channel FastDVDNet in PyTorch | |
""" | |
import torch | |
import torch.nn as nn | |
import numpy as np | |
from thop import profile | |
NewerOlder