摘要: https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_a_general_checkpoint.html 保存和加载checkpoints很有帮助。 为了保存checkpoints,必须将它们放在字典对象里,然后使用torc 阅读全文
posted @ 2022-11-05 20:47 X-ocean 阅读(446) 评论(0) 推荐(0)
摘要: 来自: https://pytorch.org/tutorials/recipes/recipes/what_is_state_dict.html 在PyTorch中,可学习的参数都被保存在模型的parameters中,可以通过model.parameters()访问到。而state_dict则是一 阅读全文
posted @ 2022-11-05 20:35 X-ocean 阅读(177) 评论(0) 推荐(0)
摘要: 来自https://pytorch.org/docs/stable/notes/modules.html A Simple Custom Module import torch from torch import nn class MyLinear(nn.Module): def __init__( 阅读全文
posted @ 2022-11-05 17:52 X-ocean 阅读(147) 评论(0) 推荐(1)
摘要: 1. 前言 记录密度图的生成,防止以后找不到。代码也是从别人那得来的 2. 高斯核模糊 在生成伪装密度图时,使用如下公式: $$ F(x) = \sum^N_{i=1} \delta(x-x_i) * G_{\sigma}(x) $$ 其实就是在有人头的地方,首先把像素的值设为1,然后对它及周围的区 阅读全文
posted @ 2022-10-26 17:00 X-ocean 阅读(848) 评论(0) 推荐(0)
摘要: 1. 起因 计算机视觉中常常会需要在图片上加文字,这样可以增强图像数据的可读性。 2. 工具 opencv-python 3. 方法 import matplotlib.pyplot as plt from PIL import Image import numpy as np input_img 阅读全文
posted @ 2022-10-26 16:47 X-ocean 阅读(402) 评论(0) 推荐(0)
摘要: 1. 起因 在做人群计数时,常常使用密度图来估计人数。密度图中每个像素的值都是介于0和1之间的浮点数,原本是灰度图。但是使用python的matplotlib.pyplot并指定cmap参数可以画出伪彩色图。如果想用代码保存这种图片该怎么办呢?这里介绍一种方法。 2. 使用的工具 python nu 阅读全文
posted @ 2022-10-26 16:10 X-ocean 阅读(329) 评论(0) 推荐(0)
摘要: RISC-V 本文摘录自:雷思磊.RISC-V架构的开源处理器及SoC研究综述[J].单片机与嵌入式系统应用,2017,17(02):56-60+76. 仅作个人学习用 ​ RISC-V是加州大学伯克利分校设计并发布的一种开源指令集架构,其目标是成为指令集架构领域的Linux,应用覆盖IoT设备、桌 阅读全文
posted @ 2021-08-05 10:32 X-ocean 阅读(2318) 评论(0) 推荐(0)
摘要: Windows Socket编程 可参考:https://docs.microsoft.com/zh-cn/windows/win32/winsock/getting-started-with-winsock 0. 准备工作 #include<WinSock2.h>//包含头文件 #pragma c 阅读全文
posted @ 2021-07-29 22:04 X-ocean 阅读(720) 评论(0) 推荐(0)
摘要: C语言的#define用法 1. 简单的宏定义 #define MAXSIZE 1000 // 有点像简单的文本替换 2. define的函数定义 // 同样类似简单文本替换 #define Add(a,b) a+b // 要注意可能会出现运算优先级的问题,比如 c*Add(a,b)*d; // 本 阅读全文
posted @ 2021-07-28 16:24 X-ocean 阅读(2329) 评论(0) 推荐(0)