文章作者: YuKiFuHaNe
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 YuKiFuHaNeの博客!
相关推荐

2023-07-14
OpenCV 视频中的模板匹配
12345678910111213141516171819202122232425262728293031323334353637import cv2import matplotlib.pyplot as pltimport numpy as nptemplate = cv2.imread('face_template.png',cv2.IMREAD_COLOR)template = cv2.cvtColor(template,cv2.COLOR_BGR2GRAY)print(template.shape)vc = cv2.VideoCapture('test.mp4')#检测打开是否正确if vc.isOpened(): open,frame = vc.read()else: open = Falsewhile open: ret,frame = vc.read() if frame is None: break if ret ==True: gray = cv2.cvtColor...

2023-07-14
GPU的使用与分配
获得当前主机上运算设备列表1234gpus = tf.config.experimental.list_physical_devices(device_type='GPU')cpus = tf.config.experimental.list_physical_devices(device_type='CPU') 设置当前程序可见的设备范围当前程序只会使用自己可见的设备,不可见的设备不 会被当前程序使用,因此可以设置当前程序可见的设 备范围。1234gpus=tf.config.experimental.list_physical_devices(device_type='GPU')#可见设备范围tf.config.experimental.set_visible_devices(devices=gpus[0:2], device_type='GPU')#设置前两快可见 指定程序只在显卡 2,3 上运行。12import osos.environ['CUDA_VISIBLE_DEVIC...

2023-07-14
图像定位
import tensorflow as tf import matplotlib.pyplot as plt %matplotlib inline from lxml import etree from matplotlib.patches import Rectangle import numpy as np import glob 查看Tensorflow版本1tf.__version__ 查看是否支持GPU加速1tf.test.is_gpu_available() 创建输入管道读取所有图片1images = glob.glob('./images/*.jpg') 读取xmls标注文件1xmls = glob.glob('./annotations/xmls/*.xml') 对读取的图片jpg与xmls进行名称提取12xmls_names = [x.split('\\')[-1].split('.xml')[0] for x in xmls]images_names = [x.spli...

2023-07-14
基本自编码器
import tensorflow as tf import matplotlib.pyplot as plt 查看Tensorflow版本1tf.__version__ 加载数据集1(x_train,_),(x_test,_) = tf.keras.datasets.mnist.load_data() 扁平化12x_train = x_train.reshape(x_train.shape[0],-1)#-1 表示自动计算x_test = x_test.reshape(x_test.shape[0],-1) 123x_train.shape,x_test.shape((60000, 28, 28), (10000, 28, 28))((60000, 784), (10000, 784)) 归一化12x_train = tf.cast(x_train,tf.float32)/255x_test = tf.cast(x_test,tf.float32)/255 设置输入、输出、压缩大小123input_size = 784hidden_size = 32output_si...

2025-05-06
CVAT搭建
Ubuntu 22.04/20.04(x86_64/amd64) 打开终端窗口。如果你不知道如何在 Ubuntu 上打开终端窗口,请阅读答案。 在终端窗口中输入以下命令来安装 Docker 和 Docker Compose。更多说明请参见此处。 123456789101112131415sudo apt-get updatesudo apt-get --no-install-recommends install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-commoncurl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_relea...

2023-12-23
雾滴粒径与 RSF 预测飘移损失和飘移距离
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167import torchimport torch.nn as nnimport torch.optim as optimfrom torch.utils.data import DataLoader, Ten...

