1、GitHub下载 LabelImg 源码
[GitHub下载地址]
2、进入python环境
根据其中Readme—>Installation—>Build from source根据不同操作系统安装相关依赖
conda install pyqt=5
conda install -c anaconda lxml
bash
3、修改相关文件
修改 labelImg\libs\utils.py 文件 82行开始
"""
函数解释:根据text(即标签名)生成对应颜色
修改自己需要的标签
"""
def generate_color_by_text(text):
s = ustr(text)
hash_code = int(hashlib.sha256(s.encode('utf-8')).hexdigest(), 16)
r = int((hash_code / 255) % 255)
g = int((hash_code / 65025) % 255)
b = int((hash_code / 16581375) % 255)
Q = QColor(r, g, b, 155)
if text == "L1":
Q = QColor(255, 0, 0, 255)
elif text == "L2
python
于 2021-12-15 18:34:46 发布 · 8.4k 阅读
