Skip to main content

A python utils package for castle945

Project description

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 许可发布,这意味着你可以自由复制和分发软件,无论个人使用还是商业用途,但修改后的源码不可闭源且必须以相同的许可证发布

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pu4c-1.5.0.tar.gz (42.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pu4c-1.5.0-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file pu4c-1.5.0.tar.gz.

File metadata

  • Download URL: pu4c-1.5.0.tar.gz
  • Upload date:
  • Size: 42.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for pu4c-1.5.0.tar.gz
Algorithm Hash digest
SHA256 152e46fb9940bd5303659f8d6954f87da1f8b492f1f9cc190bf80f3f4c792a07
MD5 c65e714c42b76e01c29bd19d52718b10
BLAKE2b-256 ed36de5aad5a91f287e169f96007fdf49e9b0a0216a406a46d5eb967265daf0c

See more details on using hashes here.

File details

Details for the file pu4c-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: pu4c-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for pu4c-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f07947d99e131a54b02fc8a174317b3a6edd8cc0655db4306b909ad6360732c7
MD5 dbc89c90bdab7d288281d3f02e3c83aa
BLAKE2b-256 b88f8fbdc2a8d54bf42d00aac3b25c1feeec5ecce15b0cf76f50b66cf1db487a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page