Skip to main content

castle945 的 Python 工具包

PyPI - Version PyPI - Downloads Coverage Status

介绍

castle945 的 Python 工具包,主要功能包括:深度学习单元测试工具集、三维数据可视化等

设计思路

  1. 模块内文件组织:工具函数写到如 utils/common_utils.py,模块的主要功能实现写到如 dictdb.py,个人偏好的端口号等默认参数配置(可按需更改)写到 config.py
  2. 模块接口暴露规则:函数尽量全暴露到包名下,直接 pu4c.xxx 以简化调用和减少接口变动
  3. 快速导包:保证 import pu4c 快速执行,这要求函数内导包,① 对于大型依赖库的工具函数如 open3d_utils.py 可以正常文件头导包,但不暴露到包名下即只能 from pu4c.cv.open3d_utils import xxx ② 对于其他文件内,大型依赖库只在函数内部导包(Python 导包有缓存机制,多次导入与单次导入耗时一致)
  4. 依赖随用随装:安装时尽量不依赖其他库,使用时安装缺失的依赖库即可正常运行

安装

# pip 安装使用
pip install pu4c

# 源码安装
pip install -e .

# 执行单元测试
pip install pytest coverage
mkdir work_dirs/
pytest tests/
# 本地运行并查看单元测试覆盖率
coverage run --source=pu4c -m pytest tests/
coverage report
# 手动上传到 coveralls(因为 CI/CD 则需要测试数据文件,比较大)
pip install coveralls
export COVERALLS_REPO_TOKEN=XXXXX # 登录/AddRepo/StartUploadingCoverage/...
coveralls

# 打包上传 pypi
pip install setuptools wheel twine
python3 setup.py sdist bdist_wheel
twine upload dist/*
pip install pu4c -i https://pypi.org/simple

快速入门

服务器端数据在本地界面中可视化

# 本地计算机作为 RPC 服务端
python -c "import pu4c; pu4c.start_rpc_server()"
ssh user@ip -R 30570:localhost:30570   # SSH 转发并在使用过程中保持终端 ssh 连接不断开,端口配置位于 pu4c/config.py,参数 -R remote_port:localhost:local_port
ssh user2@ip2 -R 30570:localhost:30570 # 可选,支持同时将多台服务器的端口转发到本机的同一个端口
# autossh -M 0 -fNT -o "ServerAliveInterval 10" -o "ServerAliveCountMax 3" -o "ExitOnForwardFailure yes" -L 9117:localhost:9117 -R 30570:localhost:30570 -R 30571:localhost:30571 amax4090

# 服务器作为 RPC 客户端,可在交互式终端(如调试终端)中使用
import pu4c
pu4c.cloud_viewer(filepath="/datasets/KITTI/object/training/velodyne/000000.bin", num_features=4, rpc=True) # 置 rpc=True 进行远程函数调用

# 注意
# 如果远程函数调用时使用了文件路径作为参数需要确保 RPC 服务器上存在该文件,可以通过 nfs 挂载到相同路径,或者修改 rpc 装饰器修改路径前缀
demo_det3d.png demo_seg3d.png demo_occ3d.png
三维目标检测可视化 三维语义分割可视化 三维占据预测可视化

许可证

本代码采用 GPL-3.0 许可发布,这意味着你可以自由复制和分发软件,无论个人使用还是商业用途,但修改后的源码不可闭源且必须以相同的许可证发布

Metadata

Release files for pu4c 1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pu4c 1.5.1
File Size Uploaded
pu4c-1.5.1.tar.gz 43.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pu4c 1.5.1
File Interpreter ABI Platform
pu4c-1.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 89.0 kB

Release files / pu4c-1.5.1.tar.gz

Download URL pu4c-1.5.1.tar.gz
Size 43.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9b41b14027f892780525c12c58a5ca0911e4d03879f4a859c0ced2dd6945ae08
BLAKE2b-256 checksum
How to use checksums
75e76ea44fea9c0c3999b7b4242a1cecbaf25d1fa48423e0dc52a436280936e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Release files / pu4c-1.5.1-py3-none-any.whl

Download URL pu4c-1.5.1-py3-none-any.whl
Size 45.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9a6b5ca39ca03ee63b5ad8ac8ba51c3ed6d843a66b17e33d9d43b1346c54992
BLAKE2b-256 checksum
How to use checksums
9118b9c4d61e8c5fa7c1824605d8bcb9e4287e89946356c63d74463a0bde3ea9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.3

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page