Fork me on github
摘要: import unicodedata def normalize_str(s: str) -> str: """ 规范化字符串。 在测试中,可能会遇到字符等价的问题,如字符“⾯”和“面”在语义上等价的, 但它们的编码不同,故需要进行Unicode规范化,以解决此类问题。 参见:https://xob 阅读全文
posted @ 2024-04-28 00:53 fang-d 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 下面给出的代码,允许用户使用LMDataset对象,加快数据集的访问速度。它预先读取传入dataset中的数据,并存储于LMDB数据库中。在ImageNet的测试表明,它能够加快图像读取速度4.25倍。 使用代码如下: from LMDataset import LMDataset from tor 阅读全文
posted @ 2024-04-01 16:07 fang-d 阅读(61) 评论(0) 推荐(0) 编辑
摘要: # -*- coding: utf-8 -*- """" This document is a simple Demo for DDP Image Classification """ from typing import Callable from argparse import Argument 阅读全文
posted @ 2024-02-08 16:31 fang-d 阅读(123) 评论(0) 推荐(0) 编辑
摘要: 创建idleGPUs.py,内容如下: #!/usr/bin/env python # -*- coding: utf-8 -*- from os import popen from typing import List def query_idle_gpus(threshold: int = 2) 阅读全文
posted @ 2023-12-05 22:54 fang-d 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 在一台新的计算机上,我们可以使用下面的代码配置git。参考资料 # 配置姓名和邮箱 git config --global user.name "John Doe" git config --global user.email johndoe@example.com # 配置默认的编辑器(可选) g 阅读全文
posted @ 2023-11-21 20:30 fang-d 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Linux下下载、安装miniforge,并去掉mamba的banner。 # Setup Miniforge wget https://mirrors.tuna.tsinghua.edu.cn/github-release/conda-forge/miniforge/LatestRelease/M 阅读全文
posted @ 2023-11-15 01:45 fang-d 阅读(1611) 评论(1) 推荐(0) 编辑
摘要: Python 在PyPlot中,我们可以进行这样的设置,对matplotlib进行客制化,并导出矢量图: # 在使用pyplot绘图,可以通过下面的参数进行全局的客制化 from matplotlib import pyplot as plt plt.rcParams['axes.grid'] = 阅读全文
posted @ 2023-07-01 17:09 fang-d 阅读(169) 评论(0) 推荐(0) 编辑
摘要: target_compile_options(${PROJECT_NAME} PRIVATE # Enable All Warnings $<$<CXX_COMPILER_ID:MSVC>:/W4 /sdl> $<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra> $<$<C 阅读全文
posted @ 2022-10-16 07:36 fang-d 阅读(628) 评论(0) 推荐(0) 编辑
摘要: Visual Studio Code使用Microsoft出品的C/C++插件,借助Clang Format工具进行代码格式化。在设置(settings.json)中,可以自行修改代码格式化的样式,如: { "C_Cpp.clang_format_fallbackStyle": "{ BasedOn 阅读全文
posted @ 2022-10-07 16:46 fang-d 阅读(962) 评论(0) 推荐(0) 编辑
摘要: 本文介绍了如何使用PyQt/PySide调用文件选择对话框选择文件的方法。 阅读全文
posted @ 2022-08-11 02:42 fang-d 阅读(759) 评论(0) 推荐(0) 编辑