参考C++版Determining object color with OpenCV
参考python多边形形状及颜色
1 | # coding=utf-8 |
参考C++版Determining object color with OpenCV
参考python多边形形状及颜色
1 | # coding=utf-8 |
参数1是源图像的某个轮廓;参数2(epsilon)是一个距离值,表示多边形的轮廓接近实际轮廓的程度,值越小,越精确;参数3表示是否闭合。
double contourArea(InputArray contour, bool oriented = false);
contour,输入的二维点集(轮廓顶点),可以是 vector 或 Mat 类型。
oriented,面向区域标识符。有默认值 false。若为 true,该函数返回一个带符号的面积值,正负取决于轮廓的方向(顺时针还是逆时针)。若为 false,表示以绝对值返回。
arcLength 函数用于计算封闭轮廓的周长或曲线的长度。
double arcLength(InputArray curve, bool closed);
curve,输入的二维点集(轮廓顶点),可以是 vector 或 Mat 类型。
closed,用于指示曲线是否封闭。
启动 WPF 应用程序所需的时间可能存在极大差异。冷启动发生在系统重启后第一次启动应用程序时,或启动应用程序、将其关闭,然后在很长一段时间后再次启动应用程序时。 应用程序启动时,如果所需的页面(代码、静态数据、注册表等)不在 Windows 内存管理器的待机列表中,会发生页面错误。 需要磁盘访问权限,以便将这些页面加载到内存中。
当已将主要公共语言运行时 (CLR) 组件的大多数页面加载到内存中时,则发生热启动,这样可节省宝贵的磁盘访问时间。 这就是为什么再次运行托管的应用程序时,该程序的启动速度更快的原因。
QQs: 冷启动是关于app资源从硬盘到内存的访问权的unefficient
在app启动就绪之前,渲染一个初始屏幕以安慰等待用户
添加图像资源(BMP、GIF、JPEG、PNG 或 TIFF 格式)到项目,在解决方案资源管理器中打开图像Properties—>Build Action选择SplashScreen
重新启动后,立即启动 WPF 应用程序,并决定用于显示的时间。 如果应用程序的所有后续启动(热启动)相较之下快很多,则冷启动问题很可能是 I/O 所致。
进程资源管理器 Procexp.exe
命令行工具 tasklist /M (显示进程调用的dll)
CSS Modules:CSS Modules将CSS文件的类名作为局部作用域进行处理,以避免全局命名冲突,同时方便了在组件中使用CSS。在React中,您可以使用Webpack和css-loader来加载CSS Modules。
Styled Components:Styled Components是一个CSS样式解决方案,它通过将CSS作为模板字符串嵌入到JavaScript中来直接在组件中定义样式,从而使组件的样式与其它代码逻辑紧密耦合。
CSS-in-JS:CSS-in-JS是使用JavaScript来动态地管理CSS样式的方法。这种方法的好处是可以通过JavaScript组合样式,动态修改样式以及动态响应用户交互。
Jenkins的Master/Slave相当于Server和agent的概念,Master提供web接口让用户来管理Job和Slave,Job可以运行在Master本机或者被分配到Slave上运行。一个Master可以关联多个Slave用来为不同的Job或相同的Job的不同配置来服务。
其显而易见的意义在于使用同一个管理界面调用不同的开发环境
在开发环境上安装一个jenkins作为slave
在服务器jenkins上添加slave node: Dashboard > Manage Jenkins > Manage Nodes and Clouds
create后进行slave node配置
保存后会提供 连接命令,需要在slave端执行
plantuml
preview in vscode:
1 | start |
1 | start |
1 | Main -> PubClientApplication |
1 | @startmindmap |
Stable Diffusion is a latent text-to-image diffusion model. Thanks to a generous compute donation from Stability AI and support from LAION, we were able to train a Latent Diffusion Model on 512x512 images from a subset of the LAION-5B database. Similar to Google’s Imagen, this model uses a frozen CLIP ViT-L/14 text encoder to condition the model on text prompts. With its 860M UNet and 123M text encoder, the model is relatively lightweight and runs on a GPU with at least 10GB VRAM.
QQs按:Stable Diffusion并非特定程序,而是一种文生图扩散模型,所谓扩散模型大致是将语意或原图,人为加入随机种子并采样,从局部要素发散以匹配学习过的素材特征,从而生成完整图像。Stability AI是推出Stable Diffusion模型的创业公司,LAION(Large-scale Artificial Intelligence Open Network)是一家非营利组织,成员来自世界各地,旨在向公众提供大规模机器学习模型、数据集和相关代码。这里需要指出的是,由于训练素材大多是512x512的小尺寸图像,使用文生图不宜创建太大尺寸,否则会被算法认为是多图拼接,欲生成大尺寸图像应由计算结果通过高清插值插件扩充。
Stable Diffusion Webui 为方便调用模型接口制作了图形化的交互界面
env requirement:
什么是LoRA模型
自然语言大模型参数庞大(如GPT参数量超过千亿),训练成本太高,因此LoRA采用了一个办法,仅训练低秩矩阵(low rank matrics),使用时将LoRA模型的参数注入(inject)SD模型,从而改变SD模型的生成风格,或者为SD模型添加新的人物/IP。
korean doll
nagetive prompt
paintings, sketchers, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, glans
not enough GPU memory
1
2
3
4
5
6
7
8 @echo off
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS= --lowvram --no-half --precision full --no-half-vae --opt-sub-quad-attention --opt-split-attention-v1 --autolaunch
call webui.bat
No python at “D:\Program Files\Anaconda3\env\py310\Python.exe”
删除项目env下除Libs外的所有文件 重新执行webui.bat资源
recommended Python3.12!
对Stable Diffusion相关工具链的进一步封装,提供工作流编辑。
GitHub1
git clone https://github.com/comfyanonymous/ComfyUI.git
编辑extramodelpaths.yaml文件以访问Stable Diffusion Webui项目目录下的模型1
2
3pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu126
pip install -r requirements.txt
python main.py --listen=127.0.0.1 --port=8188
其中torch 2.5GB下载较久 源地址 https://download.pytorch.org/whl/cu126/torch-2.6.0%2Bcu126-cp312-cp312-win_amd64.whl 下载后本地安装命令如1
pip install D:\Download\torch-2.6.0+cu126-cp312-cp312-win_amd64.whl
修改haggingface.io使用国内镜像:D:\Software\Anaconda3\envs\py312\Lib\site-packages\huggingface_hub__init.py脚本末尾添加1
os.environ['HF_ENDPOINT'] = 'https://hf-mirror.com'
ComfyUI中文手册
可见载入我们的大模型的label写的是checkpoints, 即所谓大模型放在model/checkpoints目录, checkpoints常见于RPG游戏被认为是存档点,对于训练复杂的模型,也需要记录阶段性的实验结果,以方便之后的运算基于此进行。
Keras Docs对checkpoints的解释 from《理解checkpoints》:
checkpoints是基础模型的参数定制
安装Anaconda后 默认只能在conda prompt中使用,若在cmd控制台使用conda命令
需要将Anaconda/Scripts/目录加入环境变量
可以形如下添加源的命令1
2conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
或编辑用户目录下的.condarc文件 如1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17channels:
- defaults
auto_activate_base: true
anaconda_upload: false
show_channel_urls: true
defaults_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
清理环境缓存1
conda clean -i
显示channels1
conda show channels
1 | conda create -n py310 python=3.10.6 |
TroubleShooting CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/nux-64
错误原因 D:\Anaconda3\DLLs_ssl.pyd会寻找依赖库OpenSSL DLLs,由于项目目录下未找到,它会去默认目录C:\Windows\System32查找,默认目录下存在该库,但是别的应用安装的,版本不一致,所以出现上述错误。
解决方法:从目录D:\Anaconda3\Library\bin下复制libcrypto-1_1-x64.和libssl-1_1-x64.到D:\Anaconda3\DLLs,这样就会在项目目录下直接查找到该库了。 参考CSDN Blog
列出环境1
conda env list
激活1
conda activate py310
TroubleShooting Your shell has not been properly configured to use ‘conda activate’. If using ‘conda activate’ from a batch script, change your invocation to ‘CALL conda.bat activate’.
管理员权限打开命令行 conda init cmd.exe, 同理powershell bash等终端,重启命令行即可执行activate命令
1 | conda install pandas |