castle945 的 Python 工具包
介绍
castle945 的 Python 工具包,主要功能包括:深度学习单元测试工具集、三维数据可视化等
设计思路
- 模块内文件组织:工具函数写到如
utils/common_utils.py,模块的主要功能实现写到如dictdb.py,个人偏好的端口号等默认参数配置(可按需更改)写到config.py - 模块接口暴露规则:函数尽量全暴露到包名下,直接
pu4c.xxx以简化调用和减少接口变动 - 快速导包:保证
import pu4c快速执行,这要求函数内导包,① 对于大型依赖库的工具函数如 open3d_utils.py 可以正常文件头导包,但不暴露到包名下即只能from pu4c.cv.open3d_utils import xxx② 对于其他文件内,大型依赖库只在函数内部导包(Python 导包有缓存机制,多次导入与单次导入耗时一致) - 依赖随用随装:安装时尽量不依赖其他库,使用时安装缺失的依赖库即可正常运行
安装
# 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 装饰器修改路径前缀
| 三维目标检测可视化 | 三维语义分割可视化 | 三维占据预测可视化 |
许可证
本代码采用 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pu4c-1.5.1.tar.gz | 43.2 kB | Without provenance | Details for pu4c-1.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pu4c-1.5.1-py3-none-any.whl | Python 3 | none | any | Details for pu4c-1.5.1-py3-none-any.whl |
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
|
Security for pu4c 1.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.