├── .gitignore
├── .idea
├── .gitignore
├── Python.iml
├── inspectionProfiles
│ └── profiles_settings.xml
├── misc.xml
├── modules.xml
└── vcs.xml
├── .project
├── .pydevproject
├── .settings
└── org.eclipse.core.resources.prefs
├── .vscode
└── settings.json
├── File-test.txt
├── README.md
├── anaconda_environments
└── envs.md
├── data_process
├── 01rename重命名文件.py
├── 02dataset划分并可视化.ipynb
├── 03early_fusion_data_analysis.ipynb
├── bin
│ ├── 000008.bin
│ ├── 01vis_bin.ipynb
│ ├── 02diff_bin.ipynb
│ ├── 1ConvolutionImpl.bin
│ ├── 4_Truck_0.bin
│ ├── README.md
│ └── read_write_bin.py
├── data
│ ├── 000012.bin
│ ├── 000012.pcd
│ ├── 1597975063.081979.rs-bpearl.bin
│ ├── 1597975063.081979.rs-bpearl.txt
│ ├── 34_ouster_left.bin
│ ├── 34_ouster_left.pcd
│ ├── bun01.bin
│ ├── bun01.pcd
│ ├── data.md
│ └── kitti_infos_test.pkl
├── dataset.jpg
├── img
│ └── test.py
├── json
│ ├── json2txt.py
│ ├── json2txt_lidar.py
│ ├── json2txt_lidar_rename.py
│ ├── json2txt_lidar_rename_img.py
│ ├── json_data
│ │ └── pcd.json
│ ├── json_result
│ │ ├── labelme_test.txt
│ │ └── pcd.json
│ ├── labelme_json.py
│ ├── livox_data
│ │ ├── 000000.json
│ │ └── 000015.json
│ └── livox_result
│ │ ├── 000000.txt
│ │ └── 000015.txt
├── npy&npz
│ ├── npy&npz写入和读取.ipynb
│ ├── test.npy
│ ├── testz.npz
│ └── testz_name.npz
├── pcdbin
│ ├── README.md
│ ├── bin2pcd
│ │ ├── CMakeLists.txt
│ │ ├── bin2pcd.cpp
│ │ └── build
│ │ │ ├── CMakeCache.txt
│ │ │ ├── CMakeFiles
│ │ │ ├── 3.13.2
│ │ │ │ ├── CMakeCCompiler.cmake
│ │ │ │ ├── CMakeCXXCompiler.cmake
│ │ │ │ ├── CMakeDetermineCompilerABI_C.bin
│ │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin
│ │ │ │ ├── CMakeSystem.cmake
│ │ │ │ ├── CompilerIdC
│ │ │ │ │ ├── CMakeCCompilerId.c
│ │ │ │ │ └── a.out
│ │ │ │ └── CompilerIdCXX
│ │ │ │ │ ├── CMakeCXXCompilerId.cpp
│ │ │ │ │ └── a.out
│ │ │ ├── CMakeDirectoryInformation.cmake
│ │ │ ├── CMakeError.log
│ │ │ ├── CMakeOutput.log
│ │ │ ├── Makefile.cmake
│ │ │ ├── Makefile2
│ │ │ ├── TargetDirectories.txt
│ │ │ ├── bin2pcd.dir
│ │ │ │ ├── CXX.includecache
│ │ │ │ ├── DependInfo.cmake
│ │ │ │ ├── bin2pcd.cpp.o
│ │ │ │ ├── build.make
│ │ │ │ ├── cmake_clean.cmake
│ │ │ │ ├── depend.internal
│ │ │ │ ├── depend.make
│ │ │ │ ├── flags.make
│ │ │ │ ├── link.txt
│ │ │ │ └── progress.make
│ │ │ ├── cmake.check_cache
│ │ │ ├── feature_tests.bin
│ │ │ ├── feature_tests.c
│ │ │ ├── feature_tests.cxx
│ │ │ └── progress.marks
│ │ │ ├── Makefile
│ │ │ ├── bin2pcd
│ │ │ └── cmake_install.cmake
│ └── pcd2bin
│ │ ├── CMakeLists.txt
│ │ ├── pcd2bin.cpp
│ │ └── pcd2bin.py
├── pcdnpy
│ └── pcd2npy.ipynb
├── pcdtxt
│ └── pcd2txt.py
├── pkl
│ ├── 01read_pkl.ipynb
│ ├── 02write_pkl.ipynb
│ └── test.pkl
├── pointpcd
│ └── README.md
├── test.txt
├── train.txt
├── txt
│ ├── 01file
│ │ └── files
│ │ │ └── extract.py
│ ├── 02vis_analysis_label_kitti_ouster
│ │ ├── label_kitti.ipynb
│ │ └── label_ouster.ipynb
│ ├── filename.txt
│ ├── test.txt
│ ├── txt_kitti
│ │ ├── 000000kitti.txt
│ │ ├── 000000ouster.txt
│ │ ├── 000000ouster_kittistyle.txt
│ │ ├── process_kitti.ipynb
│ │ └── process_ouster.ipynb
│ ├── txt_process.py
│ ├── txt_read.py
│ ├── txt_save.py
│ ├── txt转换pkl
│ │ ├── data
│ │ │ ├── code
│ │ │ │ ├── 0131.jpg
│ │ │ │ ├── 0153.jpg
│ │ │ │ ├── 0161.jpg
│ │ │ │ ├── 0178.jpg
│ │ │ │ └── 0398.jpg
│ │ │ ├── images
│ │ │ │ ├── Girl.jpg
│ │ │ │ ├── cat.jpg
│ │ │ │ └── dao2.jpg
│ │ │ └── inception_model
│ │ │ │ ├── imagenet_2012_challenge_label_map_proto.pbtxt
│ │ │ │ └── imagenet_synset_to_human_label_map.txt
│ │ └── txt_to_pkl txt转换pkl
│ │ │ ├── predictions
│ │ │ ├── 010001.txt
│ │ │ ├── 010002.txt
│ │ │ ├── 010003.txt
│ │ │ ├── 010004.txt
│ │ │ ├── 010005.txt
│ │ │ ├── 010006.txt
│ │ │ ├── 010007.txt
│ │ │ ├── 010008.txt
│ │ │ └── 010009.txt
│ │ │ ├── reslut.pkl
│ │ │ ├── transfer.py
│ │ │ └── txt_to_pkl.py
│ └── 读取文件名并生成txt文件.py
├── val.txt
└── yaml
│ └── yaml.ipynb
├── filename.txt
├── my file.txt
├── pickle_example.pickle
├── project-details
├── 00 小trick.ipynb
├── 00path
│ ├── 02-1 目录文件处理.ipynb
│ ├── 02-2lidar_path.ipynb
│ ├── 02path-os-details.py
│ ├── 03移动文件到另一个目录extract.py
│ ├── 04_01删除文件filter.py
│ └── 04遍历删除目标文件error.py
├── 01lr_decays.py
├── 01nms
│ ├── 01nms.ipynb
│ └── 01nms.py
├── 02kitti_waymo_字典打印输出mAp
│ └── kitti_waymo_字典打印输出mAp.ipynb
├── 03 字符串数组转成数字数组.py
├── 04 数据处理.ipynb
├── 05 __str__() 方法.py
├── 06shape&axis.py
└── 07tanh.ipynb
├── project.txt
├── python27
├── Teaching.py
└── app.py
├── python3_tutorials_莫凡
├── 01安装.py
├── 02print().py
├── 03数字.py
├── 04自变量variable.py
├── 05while循环.py
├── 06for循环.py
├── 07_09if条件.py
├── 10_11def函数 参数.py
├── 12函数默认参数.py
├── 13全局局部变量globalLocal.py
├── 14模块安装.py
├── 15读写文件1.py
├── 15读写文件2.py
├── 15读写文件3.py
├── 18class类.py
├── 19init类.py
├── 20input输入.py
├── 21元组列表.py
├── 22列表list.py
├── 23多维列表.py
├── 24字典dictionary.py
├── 25import模块.py
├── 26自己的模块.py
├── 27continue&break.py
├── 28错误处理try.py
├── 29zip_lambda_map.py
├── 30浅复制深复制(deepcopy).py
├── 31threading多线程.py
├── 32multiprocessing多核.py
├── 33tkinter.py
├── 34pickle存放数据.py
├── 35set找不同.py
├── 36RegEx正则表达式.py
├── __pycache__
│ └── m1.cpython-35.pyc
└── m1.py
├── python3_tutorials_菜鸟教程
├── 01python0.py
├── 02基本数据类型.py
├── 03函数.py
├── 04控制流.py
├── 图形界面介绍GuiTkinter和猜数字游戏.py
├── 装饰器Decorators.py
├── 输入输出方式.py
├── 错误与异常.py
└── 面向对象编程(ObjectOriented.py
├── test.py
├── tips.ipynb
├── tools
├── 01send_emails
│ └── 01send_email.ipynb
└── 02send_wechat
│ └── 01send_wechat.ipynb
├── 基本数据结构
└── 02dict.ipynb
└── 类和对象
├── 01class_basics.ipynb
├── 02_init.ipynb
└── class.py
/.gitignore:
--------------------------------------------------------------------------------
1 | build
2 |
3 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/Python.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/inspectionProfiles/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | python35
4 |
5 |
6 |
7 |
8 |
9 | org.python.pydev.PyDevBuilder
10 |
11 |
12 |
13 |
14 |
15 | org.python.pydev.pythonNature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.pydevproject:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | /${PROJECT_DIR_NAME}
5 |
6 | python 3.0
7 | python35
8 |
9 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/python0.py=UTF-8
3 | encoding/\u51FD\u6570.py=UTF-8
4 | encoding/\u56FE\u5F62\u754C\u9762\u4ECB\u7ECDGuiTkinter\u548C\u731C\u6570\u5B57\u6E38\u620F.py=UTF-8
5 | encoding/\u57FA\u672C\u6570\u636E\u7C7B\u578B.py=gbk
6 | encoding/\u63A7\u5236\u6D41.py=gbk
7 | encoding/\u88C5\u9970\u5668Decorators.py=utf-8
8 | encoding/\u8F93\u5165\u8F93\u51FA\u65B9\u5F0F.py=gbk
9 | encoding/\u9519\u8BEF\u4E0E\u5F02\u5E38.py=gbk
10 | encoding/\u9762\u5411\u5BF9\u8C61\u7F16\u7A0B\uFF08ObjectOriented.py=utf-8
11 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "python.linting.pylintEnabled": true,
3 | "files.associations": {
4 | "cctype": "cpp",
5 | "clocale": "cpp",
6 | "cmath": "cpp",
7 | "csignal": "cpp",
8 | "cstdarg": "cpp",
9 | "cstddef": "cpp",
10 | "cstdio": "cpp",
11 | "cstdlib": "cpp",
12 | "cstring": "cpp",
13 | "ctime": "cpp",
14 | "cwchar": "cpp",
15 | "cwctype": "cpp",
16 | "array": "cpp",
17 | "atomic": "cpp",
18 | "strstream": "cpp",
19 | "*.tcc": "cpp",
20 | "bitset": "cpp",
21 | "chrono": "cpp",
22 | "complex": "cpp",
23 | "cstdint": "cpp",
24 | "deque": "cpp",
25 | "list": "cpp",
26 | "unordered_map": "cpp",
27 | "vector": "cpp",
28 | "exception": "cpp",
29 | "algorithm": "cpp",
30 | "functional": "cpp",
31 | "iterator": "cpp",
32 | "map": "cpp",
33 | "memory": "cpp",
34 | "memory_resource": "cpp",
35 | "numeric": "cpp",
36 | "optional": "cpp",
37 | "ratio": "cpp",
38 | "set": "cpp",
39 | "string": "cpp",
40 | "string_view": "cpp",
41 | "system_error": "cpp",
42 | "tuple": "cpp",
43 | "type_traits": "cpp",
44 | "utility": "cpp",
45 | "fstream": "cpp",
46 | "initializer_list": "cpp",
47 | "iomanip": "cpp",
48 | "iosfwd": "cpp",
49 | "iostream": "cpp",
50 | "istream": "cpp",
51 | "limits": "cpp",
52 | "new": "cpp",
53 | "ostream": "cpp",
54 | "sstream": "cpp",
55 | "stdexcept": "cpp",
56 | "streambuf": "cpp",
57 | "thread": "cpp",
58 | "cfenv": "cpp",
59 | "cinttypes": "cpp",
60 | "typeindex": "cpp",
61 | "typeinfo": "cpp"
62 | }
63 | }
--------------------------------------------------------------------------------
/File-test.txt:
--------------------------------------------------------------------------------
1 | Python 是一个非常好的语言。
2 | 是的,的确非常好!!
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
9 |
10 | # Python
11 |
12 | Python学习
13 | 想在哪个文件夹下打开jupyter,就在相对应的文件夹下打开终端
14 | 运行
15 | ```jupyter-notebook```
16 |
17 | * python库(numpy&pandas&...)学习:https://github.com/HuangCongQing/python-libraries
18 | * https://pypi.org
19 | * https://www.lfd.uci.edu/~gohlke/pythonlibs/
20 |
21 |
22 | ### 点云相关处理
23 | * [处理kitti标注文件txt](data_process/txt/txt_kitti/process_kitti.ipynb)
24 | * [json转txt(点云标注)](./data_process/json/json2txt_lidar_rename.py)
25 | * [json转txt](./data_process/json/json2txt_lidar_rename.py)
26 |
27 | ### Tutorial
28 |
29 | * 安装requirement.txt中的包
30 | `pip3 install -r requirement.txt`
31 |
32 | ### [python3_tutorials_菜鸟教程](./python3_tutorials_菜鸟教程)
33 |
34 | 学习网站:http://www.runoob.com/python3/python3-tutorial.html
35 |
36 | ### [python3_tutorials_莫凡](./python3_tutorials_莫凡)
37 |
38 | 学习视频网址:https://www.bilibili.com/video/av16926522/?p=2
39 |
40 | ### [北邮《Python编程与实践》课程 (2020)](https://github.com/fly51fly/Practical_Python_Programming)
41 |
42 | 学习视频网址:https://www.bilibili.com/video/BV1b7411N7P2
43 |
44 | * 解决Python代码编码问题 Non-UTF-8 code starting with '\xc4' in file
45 | 导致出错的根源就是编码问题。
46 | 解决方案是:
47 | 在程序最上面加上:
48 |
49 | ```
50 | # coding=gbk
51 | ```
52 |
53 | * Python 报错 TypeError: 'str' object is not callable
54 |
55 | ```
56 | page = fi.write(str(response1.read()))
57 | ```
58 |
59 | 原因是我的一个变量名叫str和python api的某个str函数名一样,导致
60 |
61 | 检查你的代码中变量的名字,看有没有变色的,就是设别为底层函数的即可
62 |
63 | * `pip list`
64 |
65 | 该命令查看的是Python安装的第三方模块。
66 |
67 | [self](https://www.cnblogs.com/masbay/p/10688541.html)
68 |
69 | ## 命令行
70 |
71 | * 从shell中退出python命令:是. ... 从shell(终端)中退出python:. 1、输入命令行:$ exit(). 2、快捷键: ctrl+Z.
72 |
73 | ### issues
74 |
75 | 1. [同时装了Python3和Python2,怎么用pip?](https://github.com/HuangCongQing/Python/issues/3)
76 | 2. [ImportError: DLL load failed: 找不到指定的模块。](https://github.com/HuangCongQing/Python/issues/4)
77 | 3. [安装Python模块时,报错[error] Microsoft Visual C++ 14.0 is required](https://github.com/HuangCongQing/Python/issues/5)
78 | 4. [出现ReadTimeoutError(self._pool, None, 'Read timed out.')](https://github.com/HuangCongQing/Python/issues/6)
79 | 5. [python 各种包下载大全网址](https://github.com/HuangCongQing/Python/issues/7)
80 | 6. [如何简单地理解Python中的if __name__ == '__main__'](https://github.com/HuangCongQing/Python/issues/8)
81 | 7. [python中出现IndentationError:unindent does not match any outer indentation level错误](https://github.com/HuangCongQing/Python/issues/9)
82 | 8. [SyntaxError: invalid syntax](https://github.com/HuangCongQing/Python/issues/10)
83 | 9. [TypeError: slice indices must be integers or None or have an __index__ method](https://github.com/HuangCongQing/Python/issues/11)
84 | 10. [UnicodeDecodeError: 'gbk' codec can't decode byte 0xa4 in position 115: ille](https://github.com/HuangCongQing/Python/issues/12)
85 | 11. [打开Anaconda Prompt 显示显示python已停止工作](https://github.com/HuangCongQing/Python/issues/13)
86 | 12. [NoPackagesFoundError: Package missing in current win-64 channels: - cudatoolkit 7.5 2](https://github.com/HuangCongQing/Python/issues/14)
87 |
88 | ## 学习资料及视频
89 |
90 | * Python数据分析 升级版https://www.julyedu.com/my/courses
91 | * Python网络爬虫实战https://edu.hellobi.com/course/81/lessons
92 | * 廖雪峰Python 3https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000
93 | * lambda: [python lambda表达式](https://www.cnblogs.com/mxh1099/p/5386529.html)
94 |
--------------------------------------------------------------------------------
/anaconda_environments/envs.md:
--------------------------------------------------------------------------------
1 |
10 | Link to https://github.com/HuangCongQing/python-libraries
--------------------------------------------------------------------------------
/data_process/01rename重命名文件.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 |
4 | class BatchRename():
5 | """
6 | 批量重命名文件夹中的图片文件
7 | """
8 | def __init__(self,path):
9 | self.path = path
10 |
11 | def rename(self):
12 | filelist = os.listdir(self.path)
13 | total_num = len(filelist)
14 | i = 1
15 | for item in filelist:
16 | Suffix_name = ['.png', '.jpg', '.jpeg', '.tif']
17 | if item.endswith(tuple(Suffix_name)):
18 | n = 6 - len(str(i))
19 | src = os.path.join(os.path.abspath(self.path), item)
20 | dst = os.path.join(os.path.abspath(self.path), str(0) * n + str(i) + '.jpg')
21 | try:
22 | os.rename(src, dst)
23 | print('converting %s--to-->%s' % (src, dst))
24 | i = i + 1
25 | except:
26 | continue
27 | print('total %d to rename & converted %d jpgs' % (total_num, i))
28 |
29 | if __name__ == '__main__':
30 | path = "./cccc" # 图片文件夹路径
31 | demo = BatchRename(path).rename()
32 |
33 | # 输出:
34 | # converting D:\python_script\cccc\www (1).jpg --to--> D:\python_script\cccc\000001.jpg
35 | # converting D:\python_script\cccc\www (2).jpg --to--> D:\python_script\cccc\000003.jpg
36 | # converting D:\python_script\cccc\www (3).jpg --to--> D:\python_script\cccc\000004.jpg
37 | # converting D:\python_script\cccc\www (4).jpg --to--> D:\python_script\cccc\000005.jpg
38 | # converting D:\python_script\cccc\www (5).jpg --to--> D:\python_script\cccc\000006.jpg
39 | # total 10 to rename & converted 11 jpgs
40 |
--------------------------------------------------------------------------------
/data_process/bin/000008.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/bin/000008.bin
--------------------------------------------------------------------------------
/data_process/bin/01vis_bin.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "source": [
6 | "## 可视化\n",
7 | "https://www.yuque.com/huangzhongqing/hre6tf/uwe6sh#xnVS8"
8 | ],
9 | "metadata": {}
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": 1,
14 | "source": [
15 | "import numpy as np\n",
16 | "import mayavi.mlab"
17 | ],
18 | "outputs": [],
19 | "metadata": {}
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": 4,
24 | "source": [
25 | " \n",
26 | "# lidar_path换成自己的.bin文件路径\n",
27 | "# pointcloud = np.fromfile(str(\"lidar_path\"), dtype=np.float32, count=-1).reshape([-1, 4])\n",
28 | "# pointcloud = np.fromfile(str(\"./4_Truck_0.bin\"), dtype=np.float32, count=-1).reshape([-1, 4])\n",
29 | "pointcloud = np.fromfile(str(\"./000008.bin\"), dtype=np.float32, count=-1).reshape([-1, 4])\n",
30 | " \n",
31 | "x = pointcloud[:, 0] # x position of point\n",
32 | "y = pointcloud[:, 1] # y position of point\n",
33 | "z = pointcloud[:, 2] # z position of point\n",
34 | " \n",
35 | "r = pointcloud[:, 3] # reflectance value of point\n",
36 | "d = np.sqrt(x ** 2 + y ** 2) # Map Distance from sensor\n",
37 | " \n",
38 | "degr = np.degrees(np.arctan(z / d))\n",
39 | " \n",
40 | "vals = 'height'\n",
41 | "if vals == \"height\":\n",
42 | " col = z\n",
43 | "else:\n",
44 | " col = d\n",
45 | " \n",
46 | "fig = mayavi.mlab.figure(bgcolor=(0, 0, 0), size=(640, 500))\n",
47 | "mayavi.mlab.points3d(x, y, z,\n",
48 | " col, # Values used for Color\n",
49 | " mode=\"point\",\n",
50 | " colormap='spectral', # 'bone', 'copper', 'gnuplot'\n",
51 | " # color=(0, 1, 0), # Used a fixed (r,g,b) instead\n",
52 | " figure=fig,\n",
53 | " )\n",
54 | " \n",
55 | "mayavi.mlab.show()"
56 | ],
57 | "outputs": [],
58 | "metadata": {}
59 | },
60 | {
61 | "cell_type": "code",
62 | "execution_count": null,
63 | "source": [],
64 | "outputs": [],
65 | "metadata": {}
66 | }
67 | ],
68 | "metadata": {
69 | "orig_nbformat": 4,
70 | "language_info": {
71 | "name": "python",
72 | "version": "3.6.12",
73 | "mimetype": "text/x-python",
74 | "codemirror_mode": {
75 | "name": "ipython",
76 | "version": 3
77 | },
78 | "pygments_lexer": "ipython3",
79 | "nbconvert_exporter": "python",
80 | "file_extension": ".py"
81 | },
82 | "kernelspec": {
83 | "name": "python3",
84 | "display_name": "Python 3.6.12 64-bit ('torch': conda)"
85 | },
86 | "interpreter": {
87 | "hash": "33889632b9843cd8adbd3566ea201a4089a307e6b2cea65a3733113e94cf9c17"
88 | }
89 | },
90 | "nbformat": 4,
91 | "nbformat_minor": 2
92 | }
--------------------------------------------------------------------------------
/data_process/bin/1ConvolutionImpl.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/bin/1ConvolutionImpl.bin
--------------------------------------------------------------------------------
/data_process/bin/4_Truck_0.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/bin/4_Truck_0.bin
--------------------------------------------------------------------------------
/data_process/bin/README.md:
--------------------------------------------------------------------------------
1 |
10 |
11 | ## 可视化
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/data_process/bin/read_write_bin.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: https://www.yuque.com/huangzhongqing/lang/vbh9gmhu2hserqm7
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2024-03-07 19:33:43
7 | LastEditTime: 2024-03-07 19:35:01
8 | FilePath: /Python/data_process/bin/read_write_bin.py
9 | '''
10 |
11 | import numpy as np
12 | import os
13 |
14 | save_path = 'xxxx/xxx.bin'
15 | # 保存
16 | save_data = np.concatenate((depth[:, np.newaxis], xyz), axis=1)
17 | save_data.tofile( os.path.join(save_path))
18 |
19 | # 读取
20 | exited_data = np.fromfile(save_path,dtype=np.float32).reshape(-1, 9)
--------------------------------------------------------------------------------
/data_process/data/000012.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/data/000012.bin
--------------------------------------------------------------------------------
/data_process/data/1597975063.081979.rs-bpearl.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/data/1597975063.081979.rs-bpearl.bin
--------------------------------------------------------------------------------
/data_process/data/34_ouster_left.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/data/34_ouster_left.bin
--------------------------------------------------------------------------------
/data_process/data/34_ouster_left.pcd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/data/34_ouster_left.pcd
--------------------------------------------------------------------------------
/data_process/data/bun01.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/data/bun01.bin
--------------------------------------------------------------------------------
/data_process/data/bun01.pcd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/data/bun01.pcd
--------------------------------------------------------------------------------
/data_process/data/data.md:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/data_process/data/kitti_infos_test.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/data/kitti_infos_test.pkl
--------------------------------------------------------------------------------
/data_process/dataset.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/dataset.jpg
--------------------------------------------------------------------------------
/data_process/img/test.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description:
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-04-13 17:36:17
7 | LastEditTime: 2021-04-13 17:36:18
8 | FilePath: /Python/data_process/img/test.py
9 | '''
10 |
--------------------------------------------------------------------------------
/data_process/json/json2txt.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: json转txt文件
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-04-13 18:34:32
7 | LastEditTime: 2021-04-14 14:33:23
8 | FilePath: /Python/data_process/json/json2txt.py
9 | '''
10 |
11 |
12 | import os
13 | import json
14 | import numpy as np
15 | from tqdm import tqdm
16 |
17 | def read_json(json_path):
18 | # 当文件中包含中文时,设置以utf-8解码模式读取文件open(out_path, 'w',encoding='utf-8',默认以gbk模式读取文件,
19 | f = open(json_path)
20 | json_file = json.load(f)
21 | return json_file
22 |
23 |
24 | def save_json(out_path, json_file):
25 | f = open(out_path, 'w', encoding='utf-8') # 设置以utf-8解码模式读取文件,默认为gbk模式
26 | json.dump(json_file, f)
27 |
28 |
29 | def edit_labelme_json(labelme_json):
30 | # 对labelme生成的json文件进行内容编辑
31 | # labelme数据格式以字典形式存储,格式如下:
32 | # labelme_json = {'flags':{},"shapes":[],
33 | # "lineColor":[0,255,0,128],"fillColor": [255,0,0,128],
34 | # "imagePath": "",
35 | # "imageData":''}
36 | version = labelme_json['version']
37 | flags = labelme_json['flags']
38 | shapes = labelme_json['shapes'] # 获取json shape
39 | imagePath = labelme_json['imagePath']
40 | imageData = labelme_json['imageData']
41 | imageHeight = labelme_json['imageHeight']
42 | imageWidth = labelme_json['imageWidth']
43 |
44 | ##################### 编辑 #############################
45 | label_list = [] # 记录json中所有物体的标签
46 | label_dic = {} # 记录每个label出现的个数
47 |
48 | points_values = ''
49 | # imageHeight = int(imageHeight/10) #图像缩放
50 | # imageWidth = int(imageWidth/10)
51 | for tmp_shape in tqdm(shapes):
52 | for shape_key, shape_values in tmp_shape.items():
53 | # 对每个类别进行计数并修改类别标签名,将语义分割标签转化为实例分割标签
54 | if shape_key == 'points':
55 | points_values = shape_values # 二维数组
56 | np.savetxt('/home/hcq/pointcloud/Python/data_process/json/json_result/labelme_test.txt', points_values, fmt="%.18f,%.18f", delimiter="\n")
57 | # 生成一个新的json数据
58 |
59 |
60 | def list_json(path):
61 | sup_ext = ['.json']
62 | all_list = list(map(lambda x: os.path.join(path, x), os.listdir(path)))
63 | json_list = [x for x in all_list if os.path.splitext(x)[1] in sup_ext]
64 | return json_list
65 |
66 |
67 | if __name__ == '__main__':
68 | # json_dir = 'json_ori'
69 | # out_dir = 'json'
70 | json_dir = '/home/hcq/pointcloud/Python/data_process/json/json_data'
71 | out_dir = '/home/hcq/pointcloud/Python/data_process/json/json_result'
72 | json_list = list_json(json_dir)
73 | for i in range(len(json_list)):
74 | json_r = read_json(json_list[i])
75 | edit_labelme_json(json_r) # 处理json数据
76 |
--------------------------------------------------------------------------------
/data_process/json/json2txt_lidar.py:
--------------------------------------------------------------------------------
1 |
2 | '''
3 | Description:
4 | Author: HCQ
5 | Company(School): UCAS
6 | Email: 1756260160@qq.com
7 | Date: 2022-01-20 16:20:06
8 | LastEditTime: 2022-03-17 20:51:50
9 | FilePath: /Python/data_process/json/json2txt_lidar.py
10 | '''
11 |
12 | import os
13 | import json
14 | import numpy as np
15 | from tqdm import tqdm
16 |
17 | # 本文件测试
18 | json_dir = '/home/hcq/pointcloud/Python/data_process/json/livox_data/' # json文件路径
19 | out_dir = '/home/hcq/pointcloud/Python/data_process/json/livox_result/' # 输出的 txt 文件路径
20 |
21 |
22 | # 项目输入
23 | json_livox_dirs = []
24 | # json_livox = ['/home/hcq/data/2022anno/融合交付/融合交付/2021.12.10-shenbao/10.25-1', '/home/hcq/data/2022anno/融合交付/融合交付/2021.12.10-shenbao/10.25-2']
25 | json_livox = ['/home/hcq/data/2022anno/HT融合追踪交付0317/标注结果']
26 | # pcd文件
27 | pcd_livox = "/home/hcq/data/2022anno/2021.12.10-shenbao/10.25-1"
28 |
29 |
30 | # 输出
31 | out_dir_livox_txt = '/home/hcq/data/2022anno/finaul_result/txt_result/'
32 | out_dir_livox_pcd = '/home/hcq/data/2022anno/finaul_result/pcd_result/'
33 |
34 | # step1 整理目录层级,得到所有json列表
35 | for i in json_livox:
36 | # path_paths =
37 | # for path_path in os.listdir(path):
38 | # for path in json_livox + path_path:
39 | # file_path = json_livox + path_path + path
40 | for j in os.listdir(i):
41 | list_json = os.listdir('%s/%s/livox/'%(i,j))
42 | # 1 排序(转数字排序,再转字符)
43 | flielist = [int(x.split('.')[0]) for x in list_json] # 只有json
44 | flielist.sort()
45 | flielist = ['%06d.json' % x for x in flielist] # 数字转成字符00000.json
46 | # 2 遍历保存完整json路径
47 | # for k in list_json:
48 | for k in flielist:
49 | # json.load(open('%s/%s/livox/%s' % (i,j,k)))
50 | json_livox_dirs.append('%s/%s/livox/%s' % (i,j,k)) # 所有json文件路径
51 | # '/home/hcq/data/2022anno/融合交付/融合交付/2021.12.10-shenbao/10.25-1/_2021-10-25-11-40-50/livox/000002.json'
52 | # print(len(json_livox_dirs))
53 |
54 | # ======================================================上面先运行============================================================
55 | # step2 处理每个json文件
56 | def get_json(json_file, out_dir, filename):
57 | # 读取 json 文件数据
58 | with open(json_file, 'r') as load_f:
59 | content = json.load(load_f)
60 |
61 | # 修改输出文件名
62 | # filename = 0
63 | # filename = '%06d' % filename # filename 修改名字 '000000'
64 | filename_txt = out_dir + filename + '.txt' # 保存文件路径
65 | # 创建txt文件
66 | fp = open(filename_txt, mode="w", encoding="utf-8")
67 | # 将数据写入文件
68 | str_tmp = "" # 存储字符串内容
69 | # 1.获取数据============================================
70 | objects = content["objects"]
71 | # print(len(objects))
72 | # print("Output", objects[0])
73 | # 遍历障碍物
74 | for i in range(len(objects)):
75 | # 判断objects是否符合要求
76 | if "content" not in content["objects"][i].keys():
77 | continue
78 | label = content["objects"][i]["content"]["label"]
79 | # print("label:", label)
80 | str_tmp += str(label) + " " # 0维
81 | cx = (content["objects"][i])["center"]["x"]
82 | cy = (content["objects"][i])["center"]["y"]
83 | cz = (content["objects"][i])["center"]["z"]
84 | str_tmp += str(cx) + " " + str(cy)+ " " + str(cz)+ " " ##暂存内容
85 | dx = (content["objects"][i])["dimensions"]["length"]
86 | dy = (content["objects"][i])["dimensions"]["width"]
87 | dz = (content["objects"][i])["dimensions"]["height"]
88 | str_tmp += str(dx) + " " + str(dy)+ " " + str(dz)+ " " ##暂存内容
89 | yaw = (content["objects"][i])["rotation"]["z"] # 7 yaw角
90 | trackid = (content["objects"][i])["objectid"] # 8
91 | str_tmp += str(yaw) + " " + str(trackid) # 行尾
92 | # 换行
93 | str_tmp += "\n" ##暂存内容
94 | fp.write(str_tmp)
95 | fp.close()
96 |
97 | def main():
98 | files = os.listdir(json_dir) # 得到文件夹下的所有文件名称 ['000000.json', '000015.json']
99 | s = []
100 | for file in files: # 遍历文件夹
101 | filename = file.split('.')[0]
102 | # print(filename) # 000015
103 | get_json(json_dir + file, out_dir, filename)
104 | # ====================================================================================
105 |
106 | def main_livox():
107 | # 输出文件名:000000
108 | filename_livox = 0
109 | # 遍历每个json文件,输出为 out_dir_livox_txt + filename_livox +txt
110 | for file_livox in tqdm(json_livox_dirs): # 遍历文件夹
111 | # print(filename_livox) # 000015
112 | get_json(file_livox, out_dir_livox_txt, '%06d' % filename_livox)
113 | # print("Extracted %d json file"%filename_livox)
114 | filename_livox+=1 # 输出文件名从00000递增
115 | print("Extracted successfully")
116 |
117 | if __name__ == '__main__':
118 | # main()
119 | main_livox()
--------------------------------------------------------------------------------
/data_process/json/json2txt_lidar_rename.py:
--------------------------------------------------------------------------------
1 |
2 | '''
3 | Description:同时输出pcd和txt
4 | Author: HCQ
5 | Company(School): UCAS
6 | Email: 1756260160@qq.com
7 | Date: 2022-01-20 16:20:06
8 | LastEditTime: 2022-04-25 14:57:54
9 | FilePath: /Python/data_process/json/json2txt_lidar_rename.py
10 | '''
11 |
12 | import os
13 | import json
14 | import numpy as np
15 | from tqdm import tqdm
16 | import shutil
17 | import random
18 |
19 | # 本文件测试
20 | json_dir = '/home/hcq/pointcloud/Python/data_process/json/livox_data/' # json文件路径
21 | out_dir = '/home/hcq/pointcloud/Python/data_process/json/livox_result/' # 输出的 txt 文件路径
22 |
23 |
24 | # 项目输入
25 | json_livox_dirs = []
26 | # json_livox = ['/home/hcq/data/2022anno/融合交付/融合交付/2021.12.10-shenbao/10.25-1', '/home/hcq/data/2022anno/融合交付/融合交付/2021.12.10-shenbao/10.25-2']
27 | json_livox = ['/home/hcq/data/2022anno/融合追踪标注0408/标注结果']
28 | # pcd文件(原始数据转移)
29 | # /home/hcq/data/2022anno/2021.12.10-shenbao/10.25-1/_2021-10-25-09-44-52/livox
30 | pcd_livox = "/home/hcq/data/2022anno/2021.12.10-shenbao/10.25-1/"
31 |
32 |
33 | # 输出
34 | out_dir_livox_txt = '/home/hcq/data/2022anno/finaul_result/txt_result_180filter/'
35 | out_dir_livox_pcd = '/home/hcq/data/2022anno/finaul_result/pcd_result/'
36 |
37 | # step1 整理目录层级,得到所有json列表
38 | for i in json_livox:
39 | # path_paths =
40 | # for path_path in os.listdir(path):
41 | # for path in json_livox + path_path:
42 | # file_path = json_livox + path_path + path
43 | for j in os.listdir(i):
44 | list_json = os.listdir('%s/%s/livox/'%(i,j)) # ['000002.json', '000044.json', ...]
45 | # 1 排序(转数字排序,再转字符)
46 | flielist = [int(x.split('.')[0]) for x in list_json] # 只有json
47 | flielist.sort()
48 | flielist = ['%06d.json' % x for x in flielist] # 数字转成字符00000.json
49 | # 2 遍历保存完整json路径
50 | # for k in list_json:
51 | for k in flielist:
52 | # json.load(open('%s/%s/livox/%s' % (i,j,k)))
53 | json_livox_dirs.append('%s/%s/livox/%s' % (i,j,k)) # 所有json文件路径
54 | # '/home/hcq/data/2022anno/融合交付/融合交付/2021.12.10-shenbao/10.25-1/_2021-10-25-11-40-50/livox/000002.json'
55 | # print(len(json_livox_dirs))
56 |
57 | # 打乱路径
58 | print("before: ", json_livox_dirs)
59 | random.shuffle(json_livox_dirs)
60 | print("after: ", json_livox_dirs)
61 |
62 | # ======================================================上面先运行============================================================
63 | # step2 处理每个json文件
64 | # json_file '/home/hcq/data/2022anno/HT融合追踪交付0317/标注结果/_2021-10-25-10-12-37/livox/000000.json'
65 | def get_json(json_file, out_dir, filename):
66 | # 读取 json 文件数据
67 | with open(json_file, 'r') as load_f:
68 | content = json.load(load_f)
69 |
70 | # 修改输出文件名
71 | # filename = 0
72 | # filename = '%06d' % filename # filename 修改名字 '000000'
73 | filename_txt = out_dir +filename + '.txt' # 保存txt文件路径============
74 | # 保存pcd名字 json的路径
75 | pcd_path = pcd_livox + json_file.split("/")[-3] + "/livox/" + json_file.split("/")[-1].split(".")[0] + ".pcd"
76 | # 重命名并保存pcd到指定位置
77 | src = pcd_path
78 | dst = out_dir_livox_pcd + filename + ".pcd" # 保存pcd文件路径============
79 | # os.rename(src, dst) # rename不能用,相当于移动
80 | shutil.copyfile(src, dst)
81 |
82 | # 将数据写入文件
83 | str_tmp = "" # 存储字符串内容
84 | # 1.获取数据============================================
85 | objects = content["objects"]
86 | # print(len(objects))
87 | # print("Output", objects[0])
88 | # 遍历障碍物
89 | for i in range(len(objects)):
90 | # 判断objects是否符合要求
91 | if "content" not in content["objects"][i].keys():
92 | continue
93 | label = content["objects"][i]["content"]["label"]
94 | idx_2_name = {1: 'Pedestrian', 2: 'Truck', 3: 'Widebody', 5: 'Car', 4: 'Auxiliary', 6: 'Excavator'}
95 | label = idx_2_name[int(label)]
96 | # print("label:", label)
97 | cx = (content["objects"][i])["center"]["x"]
98 | if cx > 180.0: continue
99 | cy = (content["objects"][i])["center"]["y"]
100 | cz = (content["objects"][i])["center"]["z"]
101 | str_tmp += str(label) + " " # 0维
102 | str_tmp += str(cx) + " " + str(cy)+ " " + str(cz)+ " " ##暂存内容
103 | dx = (content["objects"][i])["dimensions"]["length"]
104 | dy = (content["objects"][i])["dimensions"]["width"]
105 | dz = (content["objects"][i])["dimensions"]["height"]
106 | str_tmp += str(dx) + " " + str(dy)+ " " + str(dz)+ " " ##暂存内容
107 | yaw = (content["objects"][i])["rotation"]["z"] # 7 yaw角
108 | trackid = (content["objects"][i])["objectid"] # 8
109 | str_tmp += str(yaw) + " " + str(trackid) # 行尾
110 | # 换行
111 | str_tmp += "\n" ##暂存内容
112 | if not str_tmp == "":
113 | # 创建txt文件
114 | fp = open(filename_txt, mode="w", encoding="utf-8")
115 | fp.write(str_tmp)
116 | fp.close()
117 |
118 | def main():
119 | files = os.listdir(json_dir) # 得到文件夹下的所有文件名称 ['000000.json', '000015.json']
120 | s = []
121 | for file in files: # 遍历文件夹
122 | filename = file.split('.')[0]
123 | # print(filename) # 000015
124 | get_json(json_dir + file, out_dir, filename)
125 | # ====================================================================================
126 |
127 | def main_livox():
128 | # 输出文件名:000000
129 | filename_livox = 0
130 | # 遍历每个json文件,输出为 out_dir_livox_txt + filename_livox +txt
131 | for file_livox in tqdm(json_livox_dirs): # 遍历文件夹
132 | # print(filename_livox) # 000015
133 | get_json(file_livox, out_dir_livox_txt, '%06d' % filename_livox)
134 | # print("Extracted %d json file"%filename_livox)
135 | filename_livox+=1 # 输出文件名从00000递增
136 | print("Extracted successfully")
137 |
138 | if __name__ == '__main__':
139 | # main()
140 | main_livox()
--------------------------------------------------------------------------------
/data_process/json/json_result/labelme_test.txt:
--------------------------------------------------------------------------------
1 | 53.626506024096329384,827.710843373493958097
2 | 433.144578313252964108,806.024096385542065946
3 | 865.000000000000000000,801.000000000000000000
4 | 865.000000000000000000,1346.000000000000000000
5 | 447.602409638554149751,1360.240963855421568951
6 | 50.012048192771089816,1371.084337349397401340
7 |
--------------------------------------------------------------------------------
/data_process/json/labelme_json.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: labelme json文件读取和保存
3 | Tips: 需要设置路径
4 | link: https://codeleading.com/article/59014139939/
5 | Author: HCQ
6 | Company(School): UCAS
7 | Email: 1756260160@qq.com
8 | Date: 2021-04-13 17:30:08
9 | LastEditTime: 2021-04-13 18:08:29
10 | FilePath: /Python/data_process/json/labelme_json.py
11 | '''
12 |
13 | import os,json
14 | import numpy as np
15 |
16 | def read_json(json_path):
17 | f = open(json_path) ##当文件中包含中文时,设置以utf-8解码模式读取文件open(out_path, 'w',encoding='utf-8',默认以gbk模式读取文件,
18 | json_file = json.load(f)
19 | return json_file
20 |
21 | def save_json(out_path,json_file):
22 | f = open(out_path, 'w',encoding='utf-8') ##设置以utf-8解码模式读取文件,默认为gbk模式
23 | json.dump(json_file,f)
24 |
25 | def edit_labelme_json(labelme_json):
26 | # 对labelme生成的json文件进行内容编辑
27 | # labelme数据格式以字典形式存储,格式如下:
28 | # labelme_json = {'flags':{},"shapes":[],
29 | # "lineColor":[0,255,0,128],"fillColor": [255,0,0,128],
30 | # "imagePath": "",
31 | # "imageData":''}
32 | version = labelme_json['version']
33 | flags = labelme_json['flags']
34 | shapes = labelme_json['shapes'] # 获取json shape
35 | imagePath = labelme_json['imagePath']
36 | imageData = labelme_json['imageData']
37 | imageHeight = labelme_json['imageHeight']
38 | imageWidth = labelme_json['imageWidth']
39 |
40 | ##################### 编辑 #############################
41 | label_list = [] #记录json中所有物体的标签
42 | label_dic = {} #记录每个label出现的个数
43 |
44 | # imageHeight = int(imageHeight/10) #图像缩放
45 | # imageWidth = int(imageWidth/10)
46 | new_shapes = list([])
47 | for tmp_shape in shapes:
48 | for shape_key,shape_values in tmp_shape.items():
49 | ## 对每个类别进行计数并修改类别标签名,将语义分割标签转化为实例分割标签
50 | if shape_key == 'label':
51 | # shape_values = shape_values
52 | if shape_values not in label_list:
53 | label_list.append(shape_values) # 物体标签'curb'
54 | label_dic.update({shape_values:0})
55 | shape_values = shape_values+'0'
56 | else:
57 | label_dic.update({shape_values:label_dic[shape_values]+1})
58 | shape_values = shape_values+str(label_dic[shape_values])
59 | label_values = shape_values # 'curb0'
60 | ## 其他参数均不变
61 | elif shape_key == 'points':
62 | points_values = shape_values # 二维数组
63 | elif shape_key == 'group_id':group_id_values = shape_values
64 | elif shape_key == 'shape_type':shape_type_values = shape_values
65 | elif shape_key == 'flags':flags_values = shape_values
66 | # 生成一个新的json数据
67 | new_shape = {'label':label_values,'points':points_values,'group_id':group_id_values,'shape_type':shape_type_values,'flags':flags_values}
68 | new_shapes.append(new_shape)
69 | new_json = {'version':version,
70 | 'flags':flags,
71 | 'shapes':new_shapes,
72 | 'imagePath':imagePath,
73 | 'imageData':imageData,
74 | 'imageHeight':imageHeight,
75 | 'imageWidth':imageWidth}
76 |
77 | return new_json # # 生成一个新的json数据
78 |
79 | def list_json(path):
80 | sup_ext = ['.json']
81 | all_list = list(map(lambda x:os.path.join(path,x),os.listdir(path)))
82 | json_list = [x for x in all_list if os.path.splitext(x)[1] in sup_ext]
83 | return json_list
84 |
85 | def get_outpath(out_dir,name):
86 | if not os.path.exists(out_dir):os.makedirs(out_dir)
87 | return os.path.join(out_dir,os.path.basename(name))
88 |
89 | if __name__ == '__main__':
90 | # json_dir = 'json_ori'
91 | # out_dir = 'json'
92 | json_dir = '/home/hcq/pointcloud/Python/data_process/json/json_data'
93 | out_dir = '/home/hcq/pointcloud/Python/data_process/json/json_result'
94 | json_list = list_json(json_dir)
95 | for i in range(len(json_list)):
96 | json_r = read_json(json_list[i])
97 | json_ed = edit_labelme_json(json_r) # 处理json数据
98 | outpath = get_outpath(out_dir,json_list[i])
99 | save_json(outpath,json_ed)
100 |
101 |
--------------------------------------------------------------------------------
/data_process/json/livox_data/000000.json:
--------------------------------------------------------------------------------
1 | {
2 | "extra": {
3 | "points": 24000
4 | },
5 | "frameid": 1,
6 | "info": {
7 | "points": 24000
8 | },
9 | "isvalid": true,
10 | "objects": [
11 | {
12 | "box2d": {
13 | "camera1": {
14 | "content": {},
15 | "generateMode": 1,
16 | "height": 42.91188972167593,
17 | "width": 47.91188499054049,
18 | "x": 588.6564217013515,
19 | "y": 396.7841470377654
20 | }
21 | },
22 | "center": {
23 | "x": 289.99472657187806,
24 | "y": 54.35450091578539,
25 | "z": 6.840224705613853
26 | },
27 | "content": {
28 | "label": "2"
29 | },
30 | "dimensions": {
31 | "height": 7.289484445407392,
32 | "length": 13.934992559083582,
33 | "width": 8.099242112376825
34 | },
35 | "generateMode": 1,
36 | "isExist": true,
37 | "isLeave": false,
38 | "label": "2",
39 | "objectid": 1,
40 | "quality": {
41 | "changes": {
42 | "attribute": [],
43 | "remark": "",
44 | "target": []
45 | },
46 | "errorType": {
47 | "attributeError": [],
48 | "otherError": "",
49 | "targetError": []
50 | },
51 | "qualityStatus": "unqualified"
52 | },
53 | "rotation": {
54 | "x": 0,
55 | "y": 0,
56 | "z": -3.105929578857011
57 | }
58 | },
59 | {
60 | "isExist": true,
61 | "isLeave": true,
62 | "label": "2",
63 | "objectid": 2
64 | },
65 | {
66 | "isExist": true,
67 | "isLeave": true,
68 | "label": "5",
69 | "objectid": 3
70 | }
71 | ],
72 | "quality": {
73 | "changes": [],
74 | "errorResult": {
75 | "errorType": [],
76 | "other": ""
77 | },
78 | "qualityStatus": "unqualified"
79 | },
80 | "qualityResult": [],
81 | "result": {
82 | "content": {},
83 | "quality": {
84 | "changes": {
85 | "attribute": [],
86 | "remark": ""
87 | },
88 | "errorType": {
89 | "attributeError": []
90 | }
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/data_process/json/livox_data/000015.json:
--------------------------------------------------------------------------------
1 | {
2 | "extra": {
3 | "points": 24000
4 | },
5 | "frameid": 16,
6 | "info": {
7 | "points": 24000
8 | },
9 | "isvalid": true,
10 | "objects": [
11 | {
12 | "box2d": {
13 | "camera1": {
14 | "generateMode": 1,
15 | "height": 139.2214826297073,
16 | "width": 144.1903893498678,
17 | "x": 0,
18 | "y": 345.7785173702927
19 | }
20 | },
21 | "center": {
22 | "x": 131.40966379837835,
23 | "y": 65.44129588149887,
24 | "z": 0.9977970136735522
25 | },
26 | "content": {
27 | "label": "6"
28 | },
29 | "dimensions": {
30 | "height": 9.543095289231424,
31 | "length": 10.903184808751464,
32 | "width": 7.769580355099817
33 | },
34 | "generateMode": 1,
35 | "isLeave": false,
36 | "label": "6",
37 | "objectid": 1,
38 | "quality": {
39 | "changes": {
40 | "attribute": [],
41 | "remark": "",
42 | "target": []
43 | },
44 | "errorType": {
45 | "attributeError": [],
46 | "targetError": []
47 | },
48 | "qualityStatus": "unqualified"
49 | },
50 | "rotation": {
51 | "x": 0,
52 | "y": 0,
53 | "z": 1.0279651159911893
54 | }
55 | },
56 | {
57 | "isLeave": true,
58 | "label": "2",
59 | "objectid": 2
60 | },
61 | {
62 | "box2d": {},
63 | "center": {
64 | "x": 119.8295735226243,
65 | "y": 72.5555561567527,
66 | "z": -1.583625143032997
67 | },
68 | "content": {
69 | "label": "2"
70 | },
71 | "dimensions": {
72 | "height": 6.473430496050261,
73 | "length": 12.26195306570145,
74 | "width": 6.508976047382993
75 | },
76 | "generateMode": 1,
77 | "isLeave": false,
78 | "label": "2",
79 | "objectid": 3,
80 | "quality": {
81 | "changes": {
82 | "attribute": [],
83 | "remark": "",
84 | "target": []
85 | },
86 | "errorType": {
87 | "attributeError": [],
88 | "targetError": []
89 | },
90 | "qualityStatus": "unqualified"
91 | },
92 | "rotation": {
93 | "x": 0,
94 | "y": 0,
95 | "z": -1.8921242705083332
96 | }
97 | },
98 | {
99 | "box2d": {},
100 | "center": {
101 | "x": 89.77534441388131,
102 | "y": 69.04361168724655,
103 | "z": -1.6505804474219041
104 | },
105 | "content": {
106 | "label": "2"
107 | },
108 | "dimensions": {
109 | "height": 6.533411305827718,
110 | "length": 7.776880611685819,
111 | "width": 6.489734537762171
112 | },
113 | "generateMode": 1,
114 | "isLeave": false,
115 | "label": "2",
116 | "objectid": 4,
117 | "quality": {
118 | "changes": {
119 | "attribute": [],
120 | "remark": "",
121 | "target": []
122 | },
123 | "errorType": {
124 | "attributeError": [],
125 | "targetError": []
126 | },
127 | "qualityStatus": "unqualified"
128 | },
129 | "rotation": {
130 | "x": 0,
131 | "y": 0,
132 | "z": -0.05817764016075106
133 | }
134 | }
135 | ],
136 | "quality": {
137 | "changes": [],
138 | "errorResult": {
139 | "errorType": [],
140 | "other": ""
141 | },
142 | "qualityStatus": "unqualified"
143 | },
144 | "qualityResult": [],
145 | "result": {
146 | "content": {},
147 | "quality": {
148 | "changes": {
149 | "attribute": [],
150 | "remark": ""
151 | },
152 | "errorType": {
153 | "attributeError": []
154 | }
155 | }
156 | }
157 | }
--------------------------------------------------------------------------------
/data_process/json/livox_result/000000.txt:
--------------------------------------------------------------------------------
1 | 2 289.99472657187806 54.35450091578539 6.840224705613853 13.934992559083582 8.099242112376825 7.289484445407392 -3.1059295788570111
2 |
--------------------------------------------------------------------------------
/data_process/json/livox_result/000015.txt:
--------------------------------------------------------------------------------
1 | 6 131.40966379837835 65.44129588149887 0.9977970136735522 10.903184808751464 7.769580355099817 9.543095289231424 1.02796511599118931
2 | 2 119.8295735226243 72.5555561567527 -1.583625143032997 12.26195306570145 6.508976047382993 6.473430496050261 -1.89212427050833323
3 | 2 89.77534441388131 69.04361168724655 -1.6505804474219041 7.776880611685819 6.489734537762171 6.533411305827718 -0.058177640160751064
4 |
--------------------------------------------------------------------------------
/data_process/npy&npz/npy&npz写入和读取.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "## npy和npz的写入\n",
8 | "https://www.yuque.com/huangzhongqing/hre6tf/vfm9f8\n"
9 | ]
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": 15,
14 | "metadata": {},
15 | "outputs": [],
16 | "source": [
17 | "import numpy as np\n",
18 | "\n",
19 | "a = np.arange(12).reshape(3,4)\n",
20 | "b = np.arange(2)\n",
21 | "c = np.arange(5)\n",
22 | "\n",
23 | "np.save('test.npy',a)\n",
24 | "# npz文件——压缩文件\n",
25 | "# 使用np.savez()函数可以将多个数组保存到同一个文件中。\n",
26 | "np.savez('testz.npz', a, b, c)\n",
27 | "# 如若想给保存的数组命名,而不是默认的“arr_0”、“arr_1”、“arr_2”...的话,只需修改np.savez中传递的参数即可\n",
28 | "\n",
29 | "\n",
30 | "np.savez('testz_name.npz', arr1 = a, arr2 = b, arr3 = c)"
31 | ]
32 | },
33 | {
34 | "cell_type": "markdown",
35 | "metadata": {},
36 | "source": [
37 | "## 读取"
38 | ]
39 | },
40 | {
41 | "cell_type": "code",
42 | "execution_count": 17,
43 | "metadata": {},
44 | "outputs": [
45 | {
46 | "name": "stdout",
47 | "output_type": "stream",
48 | "text": [
49 | "[[ 0 1 2 3]\n",
50 | " [ 4 5 6 7]\n",
51 | " [ 8 9 10 11]]\n",
52 | "['arr_0', 'arr_1', 'arr_2']\n",
53 | "[[ 0 1 2 3]\n",
54 | " [ 4 5 6 7]\n",
55 | " [ 8 9 10 11]]\n",
56 | "arr1: [[ 0 1 2 3]\n",
57 | " [ 4 5 6 7]\n",
58 | " [ 8 9 10 11]]\n"
59 | ]
60 | }
61 | ],
62 | "source": [
63 | "out = np.load(\"test.npy\")\n",
64 | "print(out)\n",
65 | "\n",
66 | "# 取.npz文件时使用np.load()函数 返回的是一个类似于字典的对象,因此可以通过数组名作为关键字对多个数组进行访问。\n",
67 | "outz = np.load('testz.npz')\n",
68 | "print(outz.files) # \n",
69 | "a1 = outz[outz.files[0]]\n",
70 | "print(a1)\n",
71 | "\n",
72 | "\n",
73 | "out_name = np.load('testz_name.npz')\n",
74 | "print('arr1: ',out_name['arr1'])"
75 | ]
76 | },
77 | {
78 | "cell_type": "markdown",
79 | "metadata": {},
80 | "source": []
81 | },
82 | {
83 | "cell_type": "code",
84 | "execution_count": null,
85 | "metadata": {},
86 | "outputs": [],
87 | "source": []
88 | },
89 | {
90 | "cell_type": "markdown",
91 | "metadata": {},
92 | "source": []
93 | },
94 | {
95 | "cell_type": "code",
96 | "execution_count": null,
97 | "metadata": {},
98 | "outputs": [],
99 | "source": []
100 | },
101 | {
102 | "cell_type": "markdown",
103 | "metadata": {},
104 | "source": []
105 | },
106 | {
107 | "cell_type": "code",
108 | "execution_count": null,
109 | "metadata": {},
110 | "outputs": [],
111 | "source": []
112 | }
113 | ],
114 | "metadata": {
115 | "interpreter": {
116 | "hash": "34e39c63690641fda45a9b5b3a54295d3c7c7609e6d639cc54d178959f811fe3"
117 | },
118 | "kernelspec": {
119 | "display_name": "Python 3.8.13 ('pcdet')",
120 | "language": "python",
121 | "name": "python3"
122 | },
123 | "language_info": {
124 | "codemirror_mode": {
125 | "name": "ipython",
126 | "version": 3
127 | },
128 | "file_extension": ".py",
129 | "mimetype": "text/x-python",
130 | "name": "python",
131 | "nbconvert_exporter": "python",
132 | "pygments_lexer": "ipython3",
133 | "version": "3.8.13"
134 | },
135 | "orig_nbformat": 4
136 | },
137 | "nbformat": 4,
138 | "nbformat_minor": 2
139 | }
140 |
--------------------------------------------------------------------------------
/data_process/npy&npz/test.npy:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/npy&npz/test.npy
--------------------------------------------------------------------------------
/data_process/npy&npz/testz.npz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/npy&npz/testz.npz
--------------------------------------------------------------------------------
/data_process/npy&npz/testz_name.npz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/npy&npz/testz_name.npz
--------------------------------------------------------------------------------
/data_process/pcdbin/README.md:
--------------------------------------------------------------------------------
1 |
10 |
11 | ## 生成单个bin
12 | `data_process/pcdbin/pcd2bin/pcd2bin.cpp`
13 |
14 | ```
15 | ./pcd2bin /home/hcq/pointcloud/Python/data_process/data/000012.pcd /home/hcq/pointcloud/Python/data_process/data/000012.bin
16 | ```
17 |
18 | ## 遍历生成
19 |
20 | `data_process/pcdbin/pcd2bin/pcd2bin.py`
21 |
22 | ```
23 | python pcd2bin.py convert /home/hcq/data/2022anno/finaul_result/pcd_result /home/hcq/data/2022anno/finaul_result/bin_result
24 |
25 | ```
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(bin2pcd)
3 |
4 | set(CMAKE_CXX_STANDARD 17)
5 | find_package(PCL 1.2 REQUIRED)
6 | include_directories(${PCL_INCLUDE_DIRS})
7 | link_directories(${PCL_LIBRARY_DIRS})
8 | add_definitions(${PCL_DEFINITIONS})
9 |
10 | FIND_PACKAGE( Boost 1.58 COMPONENTS program_options REQUIRED )
11 | #add_executable (pcl_visualizer_demo pcl_visualizer_demo.cpp)
12 | #target_link_libraries (pcl_visualizer_demo ${PCL_LIBRARIES})
13 |
14 | add_executable(${PROJECT_NAME} bin2pcd.cpp)
15 | target_link_libraries (${PROJECT_NAME} ${PCL_LIBRARIES} ${Boost_LIBRARIES})
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CMakeCCompiler.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_C_COMPILER "/usr/bin/cc")
2 | set(CMAKE_C_COMPILER_ARG1 "")
3 | set(CMAKE_C_COMPILER_ID "GNU")
4 | set(CMAKE_C_COMPILER_VERSION "7.5.0")
5 | set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
6 | set(CMAKE_C_COMPILER_WRAPPER "")
7 | set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11")
8 | set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert")
9 | set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
10 | set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
11 | set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
12 |
13 | set(CMAKE_C_PLATFORM_ID "Linux")
14 | set(CMAKE_C_SIMULATE_ID "")
15 | set(CMAKE_C_SIMULATE_VERSION "")
16 |
17 |
18 |
19 | set(CMAKE_AR "/usr/bin/ar")
20 | set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-7")
21 | set(CMAKE_RANLIB "/usr/bin/ranlib")
22 | set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-7")
23 | set(CMAKE_LINKER "/usr/bin/ld")
24 | set(CMAKE_COMPILER_IS_GNUCC 1)
25 | set(CMAKE_C_COMPILER_LOADED 1)
26 | set(CMAKE_C_COMPILER_WORKS TRUE)
27 | set(CMAKE_C_ABI_COMPILED TRUE)
28 | set(CMAKE_COMPILER_IS_MINGW )
29 | set(CMAKE_COMPILER_IS_CYGWIN )
30 | if(CMAKE_COMPILER_IS_CYGWIN)
31 | set(CYGWIN 1)
32 | set(UNIX 1)
33 | endif()
34 |
35 | set(CMAKE_C_COMPILER_ENV_VAR "CC")
36 |
37 | if(CMAKE_COMPILER_IS_MINGW)
38 | set(MINGW 1)
39 | endif()
40 | set(CMAKE_C_COMPILER_ID_RUN 1)
41 | set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
42 | set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
43 | set(CMAKE_C_LINKER_PREFERENCE 10)
44 |
45 | # Save compiler ABI information.
46 | set(CMAKE_C_SIZEOF_DATA_PTR "8")
47 | set(CMAKE_C_COMPILER_ABI "ELF")
48 | set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
49 |
50 | if(CMAKE_C_SIZEOF_DATA_PTR)
51 | set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
52 | endif()
53 |
54 | if(CMAKE_C_COMPILER_ABI)
55 | set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
56 | endif()
57 |
58 | if(CMAKE_C_LIBRARY_ARCHITECTURE)
59 | set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
60 | endif()
61 |
62 | set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
63 | if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
64 | set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
65 | endif()
66 |
67 |
68 |
69 |
70 |
71 | set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
72 | set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
73 | set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
74 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CMakeCXXCompiler.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_CXX_COMPILER "/usr/bin/c++")
2 | set(CMAKE_CXX_COMPILER_ARG1 "")
3 | set(CMAKE_CXX_COMPILER_ID "GNU")
4 | set(CMAKE_CXX_COMPILER_VERSION "7.5.0")
5 | set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "")
6 | set(CMAKE_CXX_COMPILER_WRAPPER "")
7 | set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "14")
8 | set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17")
9 | set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters")
10 | set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates")
11 | set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates")
12 | set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17")
13 | set(CMAKE_CXX20_COMPILE_FEATURES "")
14 |
15 | set(CMAKE_CXX_PLATFORM_ID "Linux")
16 | set(CMAKE_CXX_SIMULATE_ID "")
17 | set(CMAKE_CXX_SIMULATE_VERSION "")
18 |
19 |
20 |
21 | set(CMAKE_AR "/usr/bin/ar")
22 | set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-7")
23 | set(CMAKE_RANLIB "/usr/bin/ranlib")
24 | set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-7")
25 | set(CMAKE_LINKER "/usr/bin/ld")
26 | set(CMAKE_COMPILER_IS_GNUCXX 1)
27 | set(CMAKE_CXX_COMPILER_LOADED 1)
28 | set(CMAKE_CXX_COMPILER_WORKS TRUE)
29 | set(CMAKE_CXX_ABI_COMPILED TRUE)
30 | set(CMAKE_COMPILER_IS_MINGW )
31 | set(CMAKE_COMPILER_IS_CYGWIN )
32 | if(CMAKE_COMPILER_IS_CYGWIN)
33 | set(CYGWIN 1)
34 | set(UNIX 1)
35 | endif()
36 |
37 | set(CMAKE_CXX_COMPILER_ENV_VAR "CXX")
38 |
39 | if(CMAKE_COMPILER_IS_MINGW)
40 | set(MINGW 1)
41 | endif()
42 | set(CMAKE_CXX_COMPILER_ID_RUN 1)
43 | set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
44 | set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
45 | set(CMAKE_CXX_LINKER_PREFERENCE 30)
46 | set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
47 |
48 | # Save compiler ABI information.
49 | set(CMAKE_CXX_SIZEOF_DATA_PTR "8")
50 | set(CMAKE_CXX_COMPILER_ABI "ELF")
51 | set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
52 |
53 | if(CMAKE_CXX_SIZEOF_DATA_PTR)
54 | set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
55 | endif()
56 |
57 | if(CMAKE_CXX_COMPILER_ABI)
58 | set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
59 | endif()
60 |
61 | if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
62 | set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
63 | endif()
64 |
65 | set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "")
66 | if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX)
67 | set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}")
68 | endif()
69 |
70 |
71 |
72 |
73 |
74 | set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc")
75 | set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
76 | set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
77 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CMakeDetermineCompilerABI_C.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CMakeDetermineCompilerABI_C.bin
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CMakeDetermineCompilerABI_CXX.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CMakeDetermineCompilerABI_CXX.bin
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CMakeSystem.cmake:
--------------------------------------------------------------------------------
1 | set(CMAKE_HOST_SYSTEM "Linux-5.4.0-80-generic")
2 | set(CMAKE_HOST_SYSTEM_NAME "Linux")
3 | set(CMAKE_HOST_SYSTEM_VERSION "5.4.0-80-generic")
4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
5 |
6 |
7 |
8 | set(CMAKE_SYSTEM "Linux-5.4.0-80-generic")
9 | set(CMAKE_SYSTEM_NAME "Linux")
10 | set(CMAKE_SYSTEM_VERSION "5.4.0-80-generic")
11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64")
12 |
13 | set(CMAKE_CROSSCOMPILING "FALSE")
14 |
15 | set(CMAKE_SYSTEM_LOADED 1)
16 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CompilerIdC/a.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CompilerIdC/a.out
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CompilerIdCXX/a.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pcdbin/bin2pcd/build/CMakeFiles/3.13.2/CompilerIdCXX/a.out
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeDirectoryInformation.cmake:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.13
3 |
4 | # Relative path conversion top directories.
5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd")
6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build")
7 |
8 | # Force unix paths in dependencies.
9 | set(CMAKE_FORCE_UNIX_PATHS 1)
10 |
11 |
12 | # The C and CXX include file regular expressions for this directory.
13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})
17 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeError.log:
--------------------------------------------------------------------------------
1 | Determining if the pthread_create exist failed with the following output:
2 | Change Dir: /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp
3 |
4 | Run Build Command:"/usr/bin/make" "cmTC_3f758/fast"
5 | /usr/bin/make -f CMakeFiles/cmTC_3f758.dir/build.make CMakeFiles/cmTC_3f758.dir/build
6 | make[1]: 进入目录“/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp”
7 | Building C object CMakeFiles/cmTC_3f758.dir/CheckSymbolExists.c.o
8 | /usr/bin/cc -o CMakeFiles/cmTC_3f758.dir/CheckSymbolExists.c.o -c /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
9 | Linking C executable cmTC_3f758
10 | /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3f758.dir/link.txt --verbose=1
11 | /usr/bin/cc CMakeFiles/cmTC_3f758.dir/CheckSymbolExists.c.o -o cmTC_3f758
12 | CMakeFiles/cmTC_3f758.dir/CheckSymbolExists.c.o:在函数‘main’中:
13 | CheckSymbolExists.c:(.text+0x1b):对‘pthread_create’未定义的引用
14 | collect2: error: ld returned 1 exit status
15 | CMakeFiles/cmTC_3f758.dir/build.make:86: recipe for target 'cmTC_3f758' failed
16 | make[1]: *** [cmTC_3f758] Error 1
17 | make[1]: 离开目录“/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp”
18 | Makefile:121: recipe for target 'cmTC_3f758/fast' failed
19 | make: *** [cmTC_3f758/fast] Error 2
20 |
21 | File /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
22 | /* */
23 | #include
24 |
25 | int main(int argc, char** argv)
26 | {
27 | (void)argv;
28 | #ifndef pthread_create
29 | return ((int*)(&pthread_create))[argc];
30 | #else
31 | (void)argc;
32 | return 0;
33 | #endif
34 | }
35 |
36 | Determining if the function pthread_create exists in the pthreads failed with the following output:
37 | Change Dir: /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp
38 |
39 | Run Build Command:"/usr/bin/make" "cmTC_6a0d5/fast"
40 | /usr/bin/make -f CMakeFiles/cmTC_6a0d5.dir/build.make CMakeFiles/cmTC_6a0d5.dir/build
41 | make[1]: 进入目录“/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp”
42 | Building C object CMakeFiles/cmTC_6a0d5.dir/CheckFunctionExists.c.o
43 | /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_6a0d5.dir/CheckFunctionExists.c.o -c /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/share/cmake-3.13/Modules/CheckFunctionExists.c
44 | Linking C executable cmTC_6a0d5
45 | /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6a0d5.dir/link.txt --verbose=1
46 | /usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_6a0d5.dir/CheckFunctionExists.c.o -o cmTC_6a0d5 -lpthreads
47 | /usr/bin/ld: 找不到 -lpthreads
48 | collect2: error: ld returned 1 exit status
49 | CMakeFiles/cmTC_6a0d5.dir/build.make:86: recipe for target 'cmTC_6a0d5' failed
50 | make[1]: *** [cmTC_6a0d5] Error 1
51 | make[1]: 离开目录“/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/CMakeTmp”
52 | Makefile:121: recipe for target 'cmTC_6a0d5/fast' failed
53 | make: *** [cmTC_6a0d5/fast] Error 2
54 |
55 |
56 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/Makefile2:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.13
3 |
4 | # Default target executed when no arguments are given to make.
5 | default_target: all
6 |
7 | .PHONY : default_target
8 |
9 | # The main recursive all target
10 | all:
11 |
12 | .PHONY : all
13 |
14 | # The main recursive preinstall target
15 | preinstall:
16 |
17 | .PHONY : preinstall
18 |
19 | # The main recursive clean target
20 | clean:
21 |
22 | .PHONY : clean
23 |
24 | #=============================================================================
25 | # Special targets provided by cmake.
26 |
27 | # Disable implicit rules so canonical targets will work.
28 | .SUFFIXES:
29 |
30 |
31 | # Remove some rules from gmake that .SUFFIXES does not remove.
32 | SUFFIXES =
33 |
34 | .SUFFIXES: .hpux_make_needs_suffix_list
35 |
36 |
37 | # Suppress display of executed commands.
38 | $(VERBOSE).SILENT:
39 |
40 |
41 | # A target that is always out of date.
42 | cmake_force:
43 |
44 | .PHONY : cmake_force
45 |
46 | #=============================================================================
47 | # Set environment variables for the build.
48 |
49 | # The shell in which to execute make rules.
50 | SHELL = /bin/sh
51 |
52 | # The CMake executable.
53 | CMAKE_COMMAND = /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake
54 |
55 | # The command to remove a file.
56 | RM = /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake -E remove -f
57 |
58 | # Escaping for special characters.
59 | EQUALS = =
60 |
61 | # The top-level source directory on which CMake was run.
62 | CMAKE_SOURCE_DIR = /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd
63 |
64 | # The top-level build directory on which CMake was run.
65 | CMAKE_BINARY_DIR = /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build
66 |
67 | #=============================================================================
68 | # Target rules for target CMakeFiles/bin2pcd.dir
69 |
70 | # All Build rule for target.
71 | CMakeFiles/bin2pcd.dir/all:
72 | $(MAKE) -f CMakeFiles/bin2pcd.dir/build.make CMakeFiles/bin2pcd.dir/depend
73 | $(MAKE) -f CMakeFiles/bin2pcd.dir/build.make CMakeFiles/bin2pcd.dir/build
74 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles --progress-num=1,2 "Built target bin2pcd"
75 | .PHONY : CMakeFiles/bin2pcd.dir/all
76 |
77 | # Include target in all.
78 | all: CMakeFiles/bin2pcd.dir/all
79 |
80 | .PHONY : all
81 |
82 | # Build rule for subdir invocation for target.
83 | CMakeFiles/bin2pcd.dir/rule: cmake_check_build_system
84 | $(CMAKE_COMMAND) -E cmake_progress_start /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles 2
85 | $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/bin2pcd.dir/all
86 | $(CMAKE_COMMAND) -E cmake_progress_start /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles 0
87 | .PHONY : CMakeFiles/bin2pcd.dir/rule
88 |
89 | # Convenience name for target.
90 | bin2pcd: CMakeFiles/bin2pcd.dir/rule
91 |
92 | .PHONY : bin2pcd
93 |
94 | # clean rule for target.
95 | CMakeFiles/bin2pcd.dir/clean:
96 | $(MAKE) -f CMakeFiles/bin2pcd.dir/build.make CMakeFiles/bin2pcd.dir/clean
97 | .PHONY : CMakeFiles/bin2pcd.dir/clean
98 |
99 | # clean rule for target.
100 | clean: CMakeFiles/bin2pcd.dir/clean
101 |
102 | .PHONY : clean
103 |
104 | #=============================================================================
105 | # Special targets to cleanup operation of make.
106 |
107 | # Special rule to run CMake to check the build system integrity.
108 | # No rule that depends on this can have commands that come from listfiles
109 | # because they might be regenerated.
110 | cmake_check_build_system:
111 | $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
112 | .PHONY : cmake_check_build_system
113 |
114 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/TargetDirectories.txt:
--------------------------------------------------------------------------------
1 | /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/rebuild_cache.dir
2 | /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/edit_cache.dir
3 | /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir
4 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir/DependInfo.cmake:
--------------------------------------------------------------------------------
1 | # The set of languages for which implicit dependencies are needed:
2 | set(CMAKE_DEPENDS_LANGUAGES
3 | "CXX"
4 | )
5 | # The set of files for implicit dependencies of each language:
6 | set(CMAKE_DEPENDS_CHECK_CXX
7 | "/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/bin2pcd.cpp" "/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir/bin2pcd.cpp.o"
8 | )
9 | set(CMAKE_CXX_COMPILER_ID "GNU")
10 |
11 | # Preprocessor definitions for this target.
12 | set(CMAKE_TARGET_DEFINITIONS_CXX
13 | "DISABLE_DAVIDSDK"
14 | "DISABLE_DSSDK"
15 | "DISABLE_ENSENSO"
16 | "DISABLE_LIBUSB_1_0"
17 | "DISABLE_PCAP"
18 | "DISABLE_PNG"
19 | "DISABLE_RSSDK"
20 | "FLANN_STATIC"
21 | "QT_CORE_LIB"
22 | "QT_GUI_LIB"
23 | "QT_NO_DEBUG"
24 | "QT_WIDGETS_LIB"
25 | "qh_QHpointer"
26 | "vtkFiltersFlowPaths_AUTOINIT=1(vtkFiltersParallelFlowPaths)"
27 | "vtkIOExodus_AUTOINIT=1(vtkIOParallelExodus)"
28 | "vtkIOGeometry_AUTOINIT=1(vtkIOMPIParallel)"
29 | "vtkIOImage_AUTOINIT=1(vtkIOMPIImage)"
30 | "vtkIOParallel_AUTOINIT=1(vtkIOMPIParallel)"
31 | "vtkIOSQL_AUTOINIT=2(vtkIOMySQL,vtkIOPostgreSQL)"
32 | "vtkRenderingContext2D_AUTOINIT=1(vtkRenderingContextOpenGL)"
33 | "vtkRenderingCore_AUTOINIT=3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL)"
34 | "vtkRenderingFreeType_AUTOINIT=2(vtkRenderingFreeTypeFontConfig,vtkRenderingMatplotlib)"
35 | "vtkRenderingLIC_AUTOINIT=1(vtkRenderingParallelLIC)"
36 | "vtkRenderingVolume_AUTOINIT=1(vtkRenderingVolumeOpenGL)"
37 | )
38 |
39 | # The include file search paths:
40 | set(CMAKE_CXX_TARGET_INCLUDE_PATH
41 | "/usr/include/vtk-6.3"
42 | "/usr/include/freetype2"
43 | "/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi"
44 | "/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent"
45 | "/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include"
46 | "/usr/lib/x86_64-linux-gnu/openmpi/include"
47 | "/usr/include/python2.7"
48 | "/usr/include/x86_64-linux-gnu"
49 | "/usr/include/hdf5/openmpi"
50 | "/usr/include/libxml2"
51 | "/usr/include/jsoncpp"
52 | "/usr/include/tcl"
53 | "/usr/include/pcl-1.8"
54 | "/usr/include/eigen3"
55 | "/usr/include/ni"
56 | "/usr/include/openni2"
57 | "/usr/include/x86_64-linux-gnu/qt5"
58 | "/usr/include/x86_64-linux-gnu/qt5/QtWidgets"
59 | "/usr/include/x86_64-linux-gnu/qt5/QtGui"
60 | "/usr/include/x86_64-linux-gnu/qt5/QtCore"
61 | "/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++"
62 | )
63 |
64 | # Targets to which this target links.
65 | set(CMAKE_TARGET_LINKED_INFO_FILES
66 | )
67 |
68 | # Fortran module output directory.
69 | set(CMAKE_Fortran_TARGET_MODULE_DIR "")
70 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir/bin2pcd.cpp.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir/bin2pcd.cpp.o
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir/cmake_clean.cmake:
--------------------------------------------------------------------------------
1 | file(REMOVE_RECURSE
2 | "CMakeFiles/bin2pcd.dir/bin2pcd.cpp.o"
3 | "bin2pcd.pdb"
4 | "bin2pcd"
5 | )
6 |
7 | # Per-language clean rules from dependency scanning.
8 | foreach(lang CXX)
9 | include(CMakeFiles/bin2pcd.dir/cmake_clean_${lang}.cmake OPTIONAL)
10 | endforeach()
11 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir/flags.make:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.13
3 |
4 | # compile CXX with /usr/bin/c++
5 | CXX_FLAGS = -fPIC -std=gnu++1z
6 |
7 | CXX_DEFINES = -DDISABLE_DAVIDSDK -DDISABLE_DSSDK -DDISABLE_ENSENSO -DDISABLE_LIBUSB_1_0 -DDISABLE_PCAP -DDISABLE_PNG -DDISABLE_RSSDK -DFLANN_STATIC -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -DQT_WIDGETS_LIB -Dqh_QHpointer -DvtkFiltersFlowPaths_AUTOINIT="1(vtkFiltersParallelFlowPaths)" -DvtkIOExodus_AUTOINIT="1(vtkIOParallelExodus)" -DvtkIOGeometry_AUTOINIT="1(vtkIOMPIParallel)" -DvtkIOImage_AUTOINIT="1(vtkIOMPIImage)" -DvtkIOParallel_AUTOINIT="1(vtkIOMPIParallel)" -DvtkIOSQL_AUTOINIT="2(vtkIOMySQL,vtkIOPostgreSQL)" -DvtkRenderingContext2D_AUTOINIT="1(vtkRenderingContextOpenGL)" -DvtkRenderingCore_AUTOINIT="3(vtkInteractionStyle,vtkRenderingFreeType,vtkRenderingOpenGL)" -DvtkRenderingFreeType_AUTOINIT="2(vtkRenderingFreeTypeFontConfig,vtkRenderingMatplotlib)" -DvtkRenderingLIC_AUTOINIT="1(vtkRenderingParallelLIC)" -DvtkRenderingVolume_AUTOINIT="1(vtkRenderingVolumeOpenGL)"
8 |
9 | CXX_INCLUDES = -I/usr/include/vtk-6.3 -I/usr/include/freetype2 -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -I/usr/include/hdf5/openmpi -I/usr/include/libxml2 -I/usr/include/jsoncpp -I/usr/include/tcl -I/usr/include/pcl-1.8 -I/usr/include/eigen3 -I/usr/include/ni -I/usr/include/openni2 -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++
10 |
11 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/bin2pcd.dir/progress.make:
--------------------------------------------------------------------------------
1 | CMAKE_PROGRESS_1 = 1
2 | CMAKE_PROGRESS_2 = 2
3 |
4 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/cmake.check_cache:
--------------------------------------------------------------------------------
1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file
2 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/feature_tests.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pcdbin/bin2pcd/build/CMakeFiles/feature_tests.bin
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/feature_tests.c:
--------------------------------------------------------------------------------
1 |
2 | const char features[] = {"\n"
3 | "C_FEATURE:"
4 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304
5 | "1"
6 | #else
7 | "0"
8 | #endif
9 | "c_function_prototypes\n"
10 | "C_FEATURE:"
11 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 | "1"
13 | #else
14 | "0"
15 | #endif
16 | "c_restrict\n"
17 | "C_FEATURE:"
18 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L
19 | "1"
20 | #else
21 | "0"
22 | #endif
23 | "c_static_assert\n"
24 | "C_FEATURE:"
25 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
26 | "1"
27 | #else
28 | "0"
29 | #endif
30 | "c_variadic_macros\n"
31 |
32 | };
33 |
34 | int main(int argc, char** argv) { (void)argv; return features[argc]; }
35 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/CMakeFiles/progress.marks:
--------------------------------------------------------------------------------
1 | 2
2 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/Makefile:
--------------------------------------------------------------------------------
1 | # CMAKE generated file: DO NOT EDIT!
2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.13
3 |
4 | # Default target executed when no arguments are given to make.
5 | default_target: all
6 |
7 | .PHONY : default_target
8 |
9 | # Allow only one "make -f Makefile2" at a time, but pass parallelism.
10 | .NOTPARALLEL:
11 |
12 |
13 | #=============================================================================
14 | # Special targets provided by cmake.
15 |
16 | # Disable implicit rules so canonical targets will work.
17 | .SUFFIXES:
18 |
19 |
20 | # Remove some rules from gmake that .SUFFIXES does not remove.
21 | SUFFIXES =
22 |
23 | .SUFFIXES: .hpux_make_needs_suffix_list
24 |
25 |
26 | # Suppress display of executed commands.
27 | $(VERBOSE).SILENT:
28 |
29 |
30 | # A target that is always out of date.
31 | cmake_force:
32 |
33 | .PHONY : cmake_force
34 |
35 | #=============================================================================
36 | # Set environment variables for the build.
37 |
38 | # The shell in which to execute make rules.
39 | SHELL = /bin/sh
40 |
41 | # The CMake executable.
42 | CMAKE_COMMAND = /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake
43 |
44 | # The command to remove a file.
45 | RM = /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake -E remove -f
46 |
47 | # Escaping for special characters.
48 | EQUALS = =
49 |
50 | # The top-level source directory on which CMake was run.
51 | CMAKE_SOURCE_DIR = /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd
52 |
53 | # The top-level build directory on which CMake was run.
54 | CMAKE_BINARY_DIR = /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build
55 |
56 | #=============================================================================
57 | # Targets provided globally by CMake.
58 |
59 | # Special rule for the target rebuild_cache
60 | rebuild_cache:
61 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
62 | /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
63 | .PHONY : rebuild_cache
64 |
65 | # Special rule for the target rebuild_cache
66 | rebuild_cache/fast: rebuild_cache
67 |
68 | .PHONY : rebuild_cache/fast
69 |
70 | # Special rule for the target edit_cache
71 | edit_cache:
72 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..."
73 | /home/hcq/anaconda3/envs/torch/lib/python3.6/site-packages/cmake/data/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available.
74 | .PHONY : edit_cache
75 |
76 | # Special rule for the target edit_cache
77 | edit_cache/fast: edit_cache
78 |
79 | .PHONY : edit_cache/fast
80 |
81 | # The main all target
82 | all: cmake_check_build_system
83 | $(CMAKE_COMMAND) -E cmake_progress_start /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles/progress.marks
84 | $(MAKE) -f CMakeFiles/Makefile2 all
85 | $(CMAKE_COMMAND) -E cmake_progress_start /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/CMakeFiles 0
86 | .PHONY : all
87 |
88 | # The main clean target
89 | clean:
90 | $(MAKE) -f CMakeFiles/Makefile2 clean
91 | .PHONY : clean
92 |
93 | # The main clean target
94 | clean/fast: clean
95 |
96 | .PHONY : clean/fast
97 |
98 | # Prepare targets for installation.
99 | preinstall: all
100 | $(MAKE) -f CMakeFiles/Makefile2 preinstall
101 | .PHONY : preinstall
102 |
103 | # Prepare targets for installation.
104 | preinstall/fast:
105 | $(MAKE) -f CMakeFiles/Makefile2 preinstall
106 | .PHONY : preinstall/fast
107 |
108 | # clear depends
109 | depend:
110 | $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
111 | .PHONY : depend
112 |
113 | #=============================================================================
114 | # Target rules for targets named bin2pcd
115 |
116 | # Build rule for target.
117 | bin2pcd: cmake_check_build_system
118 | $(MAKE) -f CMakeFiles/Makefile2 bin2pcd
119 | .PHONY : bin2pcd
120 |
121 | # fast build rule for target.
122 | bin2pcd/fast:
123 | $(MAKE) -f CMakeFiles/bin2pcd.dir/build.make CMakeFiles/bin2pcd.dir/build
124 | .PHONY : bin2pcd/fast
125 |
126 | bin2pcd.o: bin2pcd.cpp.o
127 |
128 | .PHONY : bin2pcd.o
129 |
130 | # target to build an object file
131 | bin2pcd.cpp.o:
132 | $(MAKE) -f CMakeFiles/bin2pcd.dir/build.make CMakeFiles/bin2pcd.dir/bin2pcd.cpp.o
133 | .PHONY : bin2pcd.cpp.o
134 |
135 | bin2pcd.i: bin2pcd.cpp.i
136 |
137 | .PHONY : bin2pcd.i
138 |
139 | # target to preprocess a source file
140 | bin2pcd.cpp.i:
141 | $(MAKE) -f CMakeFiles/bin2pcd.dir/build.make CMakeFiles/bin2pcd.dir/bin2pcd.cpp.i
142 | .PHONY : bin2pcd.cpp.i
143 |
144 | bin2pcd.s: bin2pcd.cpp.s
145 |
146 | .PHONY : bin2pcd.s
147 |
148 | # target to generate assembly for a file
149 | bin2pcd.cpp.s:
150 | $(MAKE) -f CMakeFiles/bin2pcd.dir/build.make CMakeFiles/bin2pcd.dir/bin2pcd.cpp.s
151 | .PHONY : bin2pcd.cpp.s
152 |
153 | # Help Target
154 | help:
155 | @echo "The following are some of the valid targets for this Makefile:"
156 | @echo "... all (the default if no target is provided)"
157 | @echo "... clean"
158 | @echo "... depend"
159 | @echo "... rebuild_cache"
160 | @echo "... edit_cache"
161 | @echo "... bin2pcd"
162 | @echo "... bin2pcd.o"
163 | @echo "... bin2pcd.i"
164 | @echo "... bin2pcd.s"
165 | .PHONY : help
166 |
167 |
168 |
169 | #=============================================================================
170 | # Special targets to cleanup operation of make.
171 |
172 | # Special rule to run CMake to check the build system integrity.
173 | # No rule that depends on this can have commands that come from listfiles
174 | # because they might be regenerated.
175 | cmake_check_build_system:
176 | $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
177 | .PHONY : cmake_check_build_system
178 |
179 |
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/bin2pcd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pcdbin/bin2pcd/build/bin2pcd
--------------------------------------------------------------------------------
/data_process/pcdbin/bin2pcd/build/cmake_install.cmake:
--------------------------------------------------------------------------------
1 | # Install script for directory: /home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd
2 |
3 | # Set the install prefix
4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX)
5 | set(CMAKE_INSTALL_PREFIX "/usr/local")
6 | endif()
7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
8 |
9 | # Set the install configuration name.
10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
11 | if(BUILD_TYPE)
12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
14 | else()
15 | set(CMAKE_INSTALL_CONFIG_NAME "")
16 | endif()
17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
18 | endif()
19 |
20 | # Set the component getting installed.
21 | if(NOT CMAKE_INSTALL_COMPONENT)
22 | if(COMPONENT)
23 | message(STATUS "Install component: \"${COMPONENT}\"")
24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
25 | else()
26 | set(CMAKE_INSTALL_COMPONENT)
27 | endif()
28 | endif()
29 |
30 | # Install shared libraries without execute permission?
31 | if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
32 | set(CMAKE_INSTALL_SO_NO_EXE "1")
33 | endif()
34 |
35 | # Is this installation the result of a crosscompile?
36 | if(NOT DEFINED CMAKE_CROSSCOMPILING)
37 | set(CMAKE_CROSSCOMPILING "FALSE")
38 | endif()
39 |
40 | if(CMAKE_INSTALL_COMPONENT)
41 | set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
42 | else()
43 | set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
44 | endif()
45 |
46 | string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
47 | "${CMAKE_INSTALL_MANIFEST_FILES}")
48 | file(WRITE "/home/hcq/pointcloud/Python/data_process/pcdbin/bin2pcd/build/${CMAKE_INSTALL_MANIFEST}"
49 | "${CMAKE_INSTALL_MANIFEST_CONTENT}")
50 |
--------------------------------------------------------------------------------
/data_process/pcdbin/pcd2bin/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(pcd2bin)
3 |
4 | set(CMAKE_CXX_STANDARD 17)
5 | find_package(PCL 1.2 REQUIRED)
6 | include_directories(${PCL_INCLUDE_DIRS})
7 | link_directories(${PCL_LIBRARY_DIRS})
8 | add_definitions(${PCL_DEFINITIONS})
9 |
10 | FIND_PACKAGE( Boost 1.58 COMPONENTS program_options REQUIRED )
11 | #add_executable (pcl_visualizer_demo pcl_visualizer_demo.cpp)
12 | #target_link_libraries (pcl_visualizer_demo ${PCL_LIBRARIES})
13 |
14 | add_executable(${PROJECT_NAME} pcd2bin.cpp)
15 | target_link_libraries (${PROJECT_NAME} ${PCL_LIBRARIES} ${Boost_LIBRARIES})
--------------------------------------------------------------------------------
/data_process/pcdbin/pcd2bin/pcd2bin.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * @Description: 运行
3 | ./pcd2bin /home/hcq/pointcloud/Python/data_process/data/1597975063.081979.rs-bpearl.pcd /home/hcq/pointcloud/Python/data_process/data/1597975063.081979.rs-bpearl.bin
4 | ./pcd2bin /home/hcq/pointcloud/Python/data_process/data/000012.pcd /home/hcq/pointcloud/Python/data_process/data/000012.bin
5 | * @Author: HCQ
6 | * @Company(School): UCAS
7 | * @Email: 1756260160@qq.com
8 | * @Date: 2021-07-30 17:13:40
9 | * @LastEditTime: 2021-08-16 16:33:01
10 | * @FilePath: /Python/data_process/pcdbin/pcd2bin/pcd2bin.cpp
11 | */
12 | /*
13 | * @Author: your name
14 | * @Date: 2021-07-30 17:13:40
15 | * @LastEditTime: 2021-07-31 12:03:26
16 | * @LastEditors: Please set LastEditors
17 | * @Description: In User Settings Edit
18 | * @FilePath: /Python/data_process/pcdbin/pcd2bin.cpp
19 | */
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 |
26 | #include
27 | #include
28 |
29 | #include
30 |
31 | #include
32 | #include
33 |
34 | #include
35 |
36 |
37 |
38 | void convertPCDtoBin(std::string &in_file, std::string& out_file)
39 | {
40 | pcl::PointCloud::Ptr cloud(new pcl::PointCloud);
41 |
42 | if (pcl::io::loadPCDFile(in_file, *cloud) == -1) //* load the file
43 | {
44 | std::string err = "Couldn't read file " + in_file;
45 | PCL_ERROR(err.c_str());
46 | return;// (-1);
47 | }
48 | std::cout << "Loaded "
49 | << cloud->width * cloud->height
50 | << " data points from "
51 | << in_file
52 | << " with the following fields: "
53 | << std::endl;
54 |
55 | std::ofstream myFile(out_file.c_str(), std::ios::out | std::ios::binary);
56 | for (int j = 0; j < cloud->size(); j++) {
57 |
58 | myFile.write((char*)& cloud->at(j).x, sizeof(cloud->at(j).x));
59 | myFile.write((char*)& cloud->at(j).y, sizeof(cloud->at(j).y));
60 | myFile.write((char*)& cloud->at(j).z, sizeof(cloud->at(j).z));
61 | // myFile.write((char *)& cloud->at(j).intensity, sizeof(cloud->at(j).intensity)); // 正常intensity
62 | cloud->at(j).intensity = 0;
63 | myFile.write((char *)& cloud->at(j).intensity, sizeof(cloud->at(j).intensity)); // intensity = 0
64 | // myFile << cloud->at(j).x << " " << cloud->at(j).y << " " << cloud->at(j).z << std::endl;
65 | std::cout << "point: " << cloud->at(j).x << " " << cloud->at(j).y << " " << cloud->at(j).z << " " << cloud->at(j).intensity << std::endl;
66 | }
67 | myFile.close();
68 | }
69 |
70 |
71 | int main(int argc, char **argv)
72 | {
73 | std::string str1 = argv[1] ;// "/home/hcq/pointcloud/Python/data_process/data/1597975063.081979.rs-bpearl.pcd";
74 | std::string str2 = argv[2] ;// "/home/hcq/pointcloud/Python/data_process/data/1597975063.081979.rs-bpearl.bin";
75 | convertPCDtoBin(str1,str2);
76 |
77 | return 0;
78 | }
--------------------------------------------------------------------------------
/data_process/pcdbin/pcd2bin/pcd2bin.py:
--------------------------------------------------------------------------------
1 | # coding=UTF-8
2 | '''
3 | Author: your name
4 | 运行命令:python pcd2bin.py convert /home/hcq/pointcloud/Python/data_process/data /home/hcq/pointcloud/Python/data_process/data
5 | Date: 2021-07-28 16:27:26
6 | LastEditTime: 2021-10-21 21:20:05
7 | LastEditors: Please set LastEditors
8 | Description: In User Settings Edit
9 | FilePath: /Python/data_process/pcdbin/pcd2bin/pcd2bin.py
10 | '''
11 |
12 | import os
13 | import numpy as np
14 | import fire
15 |
16 | def read_pcd(filepath):
17 | lidar = []
18 | with open(filepath,'r', encoding='utf-8') as f: # encoding='gbk'
19 | line = f.readline().strip() # decode('gbk')
20 | while line:
21 | linestr = line.split(" ") # -0.015800 -0.000408 0.000000 0.0 = len(linestr) =4
22 | if len(linestr) == 4: # 判断坐标位置(每行空格分成多多少个)===========================================
23 | linestr_convert = list(map(float, linestr))
24 | # linestr_convert.append(0) # intensity补0
25 | print("linestr_convert: ", linestr_convert)
26 | lidar.append(linestr_convert)
27 | # if len(linestr) == 3: # 判断坐标位置(每行空格分成多多少个)===========================================
28 | # linestr_convert = list(map(float, linestr))
29 | # linestr_convert.append(0) # intensity补0
30 | # print("linestr_convert: ", linestr_convert)
31 | # lidar.append(linestr_convert)
32 | line = f.readline().strip()
33 | # print("line: ", line)
34 | return np.array(lidar)
35 |
36 |
37 | def convert(pcdfolder, binfolder):
38 | current_path = os.getcwd()
39 | ori_path = os.path.join(current_path, pcdfolder)
40 | file_list = os.listdir(ori_path)
41 | des_path = os.path.join(current_path, binfolder)
42 | if os.path.exists(des_path):
43 | pass
44 | else:
45 | os.makedirs(des_path)
46 | for file in file_list: # list遍历
47 | (filename,extension) = os.path.splitext(file) # 文件和扩展名
48 | if extension=='.pcd': # 判断
49 | velodyne_file = os.path.join(ori_path, filename) + '.pcd'
50 | print("============当前读取文件: %+10s =========" %(velodyne_file))
51 | pl = read_pcd(velodyne_file)
52 | pl = pl.reshape(-1, 4).astype(np.float32) # 自己设置四列!!!!=================x,y,z,intensity
53 | print("pl: %s" %(pl))
54 | velodyne_file_new = os.path.join(des_path, filename) + '.bin'
55 | pl.tofile(velodyne_file_new)
56 |
57 | if __name__ == "__main__":
58 | fire.Fire()
--------------------------------------------------------------------------------
/data_process/pcdnpy/pcd2npy.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "source": [
6 | "# pcd转npy"
7 | ],
8 | "metadata": {}
9 | },
10 | {
11 | "cell_type": "code",
12 | "execution_count": 8,
13 | "source": [
14 | "\n",
15 | "from pypcd import pypcd\n",
16 | "cloud=pypcd.PointCloud.from_path('../data/bun01.pcd')\n",
17 | "import pprint\n",
18 | "pprint.pprint(cloud.get_metadata())\n",
19 | "import numpy as np\n",
20 | "new = cloud.pc_data.copy() # 把数据复制给new数组\n"
21 | ],
22 | "outputs": [
23 | {
24 | "output_type": "error",
25 | "ename": "ModuleNotFoundError",
26 | "evalue": "No module named 'cStringIO'",
27 | "traceback": [
28 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
29 | "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
30 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mpypcd\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpypcd\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0mcloud\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mpypcd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPointCloud\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_path\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'../data/bun01.pcd'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mpprint\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mpprint\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcloud\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_metadata\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
31 | "\u001b[0;32m~/.local/lib/python3.6/site-packages/pypcd/pypcd.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mstruct\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mcopy\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0;32mimport\u001b[0m \u001b[0mcStringIO\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0msio\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 16\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mnumpy\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 17\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mwarnings\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
32 | "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'cStringIO'"
33 | ]
34 | }
35 | ],
36 | "metadata": {}
37 | },
38 | {
39 | "cell_type": "markdown",
40 | "source": [
41 | "## ModuleNotFoundError: No module named 'cStringIO'"
42 | ],
43 | "metadata": {}
44 | },
45 | {
46 | "cell_type": "markdown",
47 | "source": [],
48 | "metadata": {}
49 | }
50 | ],
51 | "metadata": {
52 | "orig_nbformat": 4,
53 | "language_info": {
54 | "name": "python",
55 | "version": "3.6.12"
56 | },
57 | "kernelspec": {
58 | "name": "python3",
59 | "display_name": "Python 3.6.12 64-bit ('common': conda)"
60 | },
61 | "interpreter": {
62 | "hash": "23f77d03b5a41e4d3ddb9e0caaaf52efc8b96489adee7c10c83419330a6f57cc"
63 | }
64 | },
65 | "nbformat": 4,
66 | "nbformat_minor": 2
67 | }
--------------------------------------------------------------------------------
/data_process/pcdtxt/pcd2txt.py:
--------------------------------------------------------------------------------
1 | '''
2 | Author: your name
3 | https://blog.csdn.net/weixin_44128857/article/details/109308833
4 | Date: 2021-07-30 15:58:22
5 | LastEditTime: 2021-07-30 15:59:55
6 | LastEditors: Please set LastEditors
7 | Description: In User Settings Edit
8 | FilePath: /Python/data_process/pcdtxt/pcd2txt.py
9 | '''
10 | import pcl
11 | import numpy as np
12 | single_pcd_points = pcl.load('/home/hcq/pointcloud/Python/data_process/data/1597975063.081979.rs-bpearl.pcd') # 用load_XYZI()可以提取第四维信息,但该信息通常没用
13 | single_pcd_points_np = single_pcd_points.to_array() #转成numpy格式
14 | # 写入文件
15 | np.savetxt("/home/hcq/pointcloud/Python/data_process/data/1597975063.081979.rs-bpearl.txt", single_pcd_points_np,fmt='%f',delimiter=',') #格式为浮点型,用“,”隔开
16 | # 从文件中取出
17 | points = np.loadtxt('/home/hcq/pointcloud/Python/data_process/data/1597975063.081979.rs-bpearl.txt',delimiter=',')
18 | print("**************")
19 | print("done!")
20 | print(points)
21 |
--------------------------------------------------------------------------------
/data_process/pkl/01read_pkl.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "## python中pkl文件的读写\n",
8 | "\n",
9 | "https://www.yuque.com/huangzhongqing/lang/tgblk4\n"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": 7,
15 | "metadata": {},
16 | "outputs": [
17 | {
18 | "name": "stdout",
19 | "output_type": "stream",
20 | "text": [
21 | "(7518,)\n",
22 | "{'num_features': 4, 'lidar_idx': '000000'}\n"
23 | ]
24 | }
25 | ],
26 | "source": [
27 | "# 方法1:pickle\n",
28 | "import pickle\n",
29 | "import numpy as np\n",
30 | "# # 重点是rb和r的区别,rb是打开二进制文件,r是打开文本文件\n",
31 | "# f=open('/home/hcq/pointcloud/Python/data_process/data/kitti_infos_test.pkl','rb')\n",
32 | "# data = pickle.load(f)\n",
33 | "\n",
34 | "with open('/home/hcq/pointcloud/Python/data_process/data/kitti_infos_test.pkl','rb') as f:\n",
35 | " data=pickle.load(f)\n",
36 | " f.close()\n",
37 | "# print(data)\n",
38 | "# print(data.shape) # AttributeError: 'list' object has no attribute 'shape'\n",
39 | "print(np.array(data).shape)\n",
40 | "print(np.array(data)[0]['point_cloud'])"
41 | ]
42 | },
43 | {
44 | "cell_type": "code",
45 | "execution_count": 8,
46 | "metadata": {},
47 | "outputs": [
48 | {
49 | "name": "stdout",
50 | "output_type": "stream",
51 | "text": [
52 | "{'num_features': 4, 'lidar_idx': '000000'}\n"
53 | ]
54 | }
55 | ],
56 | "source": [
57 | "# 方法2:;pandas\n",
58 | "import pandas as pd\n",
59 | "import numpy as np\n",
60 | "\n",
61 | "# df = pd.DataFrame(np.arange(20).reshape(4,5))\n",
62 | "# df.to_pickle('foo.pkl')\n",
63 | "data=pd.read_pickle('/home/hcq/pointcloud/Python/data_process/data/kitti_infos_test.pkl')\n",
64 | "print(data[0]['point_cloud'])\n"
65 | ]
66 | },
67 | {
68 | "cell_type": "code",
69 | "execution_count": null,
70 | "metadata": {},
71 | "outputs": [],
72 | "source": []
73 | }
74 | ],
75 | "metadata": {
76 | "interpreter": {
77 | "hash": "23f77d03b5a41e4d3ddb9e0caaaf52efc8b96489adee7c10c83419330a6f57cc"
78 | },
79 | "kernelspec": {
80 | "display_name": "Python 3.6.12 64-bit ('common': conda)",
81 | "name": "python3"
82 | },
83 | "language_info": {
84 | "codemirror_mode": {
85 | "name": "ipython",
86 | "version": 3
87 | },
88 | "file_extension": ".py",
89 | "mimetype": "text/x-python",
90 | "name": "python",
91 | "nbconvert_exporter": "python",
92 | "pygments_lexer": "ipython3",
93 | "version": "3.6.12"
94 | },
95 | "orig_nbformat": 4
96 | },
97 | "nbformat": 4,
98 | "nbformat_minor": 2
99 | }
100 |
--------------------------------------------------------------------------------
/data_process/pkl/02write_pkl.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "## pkl可保存 字符串、列表、字典等数据\n",
8 | "\n",
9 | "https://www.yuque.com/huangzhongqing/lang/tgblk4\n",
10 | "\n",
11 | "b = pickle.dump(a)\n",
12 | "c = pickle.load(b)"
13 | ]
14 | },
15 | {
16 | "cell_type": "code",
17 | "execution_count": 7,
18 | "metadata": {},
19 | "outputs": [],
20 | "source": [
21 | "import pickle\n",
22 | "\n",
23 | "data_dict = {\n",
24 | " 'name': 'hcq',\n",
25 | " 'age': 12\n",
26 | "}\n",
27 | "data_list = [1,2,3]\n",
28 | "\n",
29 | "with open('./test.pkl', 'wb') as f:\n",
30 | " pickle.dump(data_list, f)\n"
31 | ]
32 | },
33 | {
34 | "cell_type": "code",
35 | "execution_count": 12,
36 | "metadata": {},
37 | "outputs": [
38 | {
39 | "name": "stdout",
40 | "output_type": "stream",
41 | "text": [
42 | "[1, 2, 3]\n",
43 | "\n"
44 | ]
45 | }
46 | ],
47 | "source": [
48 | "\n",
49 | "with open('./test.pkl', 'rb') as f:\n",
50 | " a = pickle.load(f)\n",
51 | " print(a)\n",
52 | " print(type(a))\n"
53 | ]
54 | },
55 | {
56 | "cell_type": "code",
57 | "execution_count": null,
58 | "metadata": {},
59 | "outputs": [],
60 | "source": []
61 | }
62 | ],
63 | "metadata": {
64 | "interpreter": {
65 | "hash": "34e39c63690641fda45a9b5b3a54295d3c7c7609e6d639cc54d178959f811fe3"
66 | },
67 | "kernelspec": {
68 | "display_name": "Python 3.8.13 ('pcdet')",
69 | "language": "python",
70 | "name": "python3"
71 | },
72 | "language_info": {
73 | "codemirror_mode": {
74 | "name": "ipython",
75 | "version": 3
76 | },
77 | "file_extension": ".py",
78 | "mimetype": "text/x-python",
79 | "name": "python",
80 | "nbconvert_exporter": "python",
81 | "pygments_lexer": "ipython3",
82 | "version": "3.8.13"
83 | },
84 | "orig_nbformat": 4
85 | },
86 | "nbformat": 4,
87 | "nbformat_minor": 2
88 | }
89 |
--------------------------------------------------------------------------------
/data_process/pkl/test.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/pkl/test.pkl
--------------------------------------------------------------------------------
/data_process/pointpcd/README.md:
--------------------------------------------------------------------------------
1 |
10 | ## 点云数据转pcd文件
11 |
12 |
13 |
--------------------------------------------------------------------------------
/data_process/txt/01file/files/extract.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | files = os.listdir('./')
4 | try:
5 | os.mkdir('../extracted')
6 | except:
7 | print('The folder has been created!!!')
8 |
9 | for file in files:
10 | if file.split('.')[-1] == 'py':
11 | continue
12 | else:
13 | print('Excuting {}'.format(file))
14 | with open(file, 'r') as f:
15 | with open('../extracted/'+file, 'w') as p:
16 | count = 0
17 | for line in f.readlines():
18 | if '>' == line[0]:
19 | count += 1
20 | if count == 3:
21 | p.close()
22 | break
23 | p.write(line)
24 | f.close()
25 |
26 | '''
27 | with open("./Valid name hits for D1-1.txt", "r") as f:
28 | data = f.readline()
29 | print(data)
30 | '''
--------------------------------------------------------------------------------
/data_process/txt/test.txt:
--------------------------------------------------------------------------------
1 | 0.000000000000000000,1.000000000000000000,2.000000000000000000,3.000000000000000000,4.000000000000000000
2 | 0.000000000000000000,2.000000000000000000,4.000000000000000000,6.000000000000000000,8.000000000000000000
3 | 0.000000000000000000,3.000000000000000000,6.000000000000000000,9.000000000000000000,12.000000000000000000
4 |
--------------------------------------------------------------------------------
/data_process/txt/txt_kitti/000000kitti.txt:
--------------------------------------------------------------------------------
1 | Truck 0.00 0 -1.57 599.41 156.40 629.75 189.25 2.85 2.63 12.34 0.47 1.49 69.44 -1.56
2 | Car 0.00 0 1.85 387.63 181.54 423.81 203.12 1.67 1.87 3.69 -16.53 2.39 58.49 1.57
3 | Cyclist 0.00 3 -1.65 676.60 163.95 688.98 193.93 1.86 0.60 2.02 4.59 1.32 45.84 -1.55
4 | DontCare -1 -1 -10 503.89 169.71 590.61 190.13 -1 -1 -1 -1000 -1000 -1000 -10
5 | DontCare -1 -1 -10 511.35 174.96 527.81 187.45 -1 -1 -1 -1000 -1000 -1000 -10
6 | DontCare -1 -1 -10 532.37 176.35 542.68 185.27 -1 -1 -1 -1000 -1000 -1000 -10
7 | DontCare -1 -1 -10 559.62 175.83 575.40 183.15 -1 -1 -1 -1000 -1000 -1000 -10
8 |
--------------------------------------------------------------------------------
/data_process/txt/txt_kitti/000000ouster.txt:
--------------------------------------------------------------------------------
1 | Truck 23.993548145171815 -12.739941812507684 -0.36031911422858276 12.504828276858674 8.34002923274409 7.532050105135633 -0.9437256977598043
2 | Excavator 46.18895309993388 -44.8425769813457 -0.18315541744232178 16.711626142283873 3.9203361646195454 6.98018099784851 0.531891184075941
3 | Widebody 55.29291027745209 34.22592295080128 -0.6067225597216265 4.042755973781112 1.658953235199069 4.899275016370133 0.24802047385311177
4 | Truck 65.79371238977741 16.640755268172832 2.6541123776025857 2.647803534385339 6.272589396148364 9.575877608381253 1.43664689019158
5 | Pedestrian 13.80351455283122 -8.356476903250732 -2.887029528617859 0.3560365608098151 0.23894134393921918 1.6401670169830322 0.4992040685384871
6 | Pedestrian 14.937343649598848 -7.02851920158248 -2.79945002445566 0.5431902327449888 0.4585907118794559 1.7716600777504312 0.5334779995021175
7 | Car 21.959687117177264 -47.09619542314231 -3.634701106733207 4.4725182431520905 0.45812277546713287 1.529976096523054 1.1090726815836716
8 | Truck 32.11975965338263 -45.413255270899725 -0.37482731425800486 8.478923809647586 6.534787325995467 5.85106455969887 2.521077687071955
--------------------------------------------------------------------------------
/data_process/txt/txt_kitti/000000ouster_kittistyle.txt:
--------------------------------------------------------------------------------
1 | Truck -1 -1 5.0806513538063305 -1 -1 -1 -1 7.3628653565400395 8.434389348438224 13.781883925527127 8.760963280453545 18.02125826719914 0.35318822934935673 -3.0573518879487467 -1
2 | Car -1 -1 -0.5307459567869687 -1 -1 -1 -1 1.7384445604316396 1.9286354571022009 5.031310189014906 33.2362138377787 16.35833872115958 -1.1704060105430352 3.214963182657664 -1
--------------------------------------------------------------------------------
/data_process/txt/txt_process.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description:
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-04-13 17:29:15
7 | LastEditTime: 2024-10-08 19:10:02
8 | FilePath: /Python/data_process/txt/txt_process.py
9 | '''
10 |
11 |
12 | def process_txt(path):
13 | origin_points = []
14 | unique_points = []
15 | time = []
16 | lines = 0
17 | with open(path, 'r', encoding="utf-8") as f:
18 | for line in f.readlines():
19 | lines += 1
20 | if 'origin_points' in line:
21 | origin_points.append(int(line.split(":")[-1].strip()))
22 | if 'unique_points' in line:
23 | unique_points.append(int(line.split(":")[-1].strip()))
24 | if 'time_statistics_logger.cc:148] perception::LidarSemanticSegmentationModule' in line:
25 | time.append(float(line.split("|")[1].strip()))
26 | print(origin_points, unique_points, time)
27 |
28 | if __name__ == '__main__':
29 | path = "/home/chongqinghuang/code/deploy/main/test.log"
30 | process_txt(path)
--------------------------------------------------------------------------------
/data_process/txt/txt_read.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description:
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-04-13 18:12:20
7 | LastEditTime: 2022-09-21 17:42:33
8 | FilePath: /Python/data_process/txt/txt_read.py
9 | '''
10 |
11 | with open('../extracted/'+file, 'r') as p:
12 | count = 0
13 | for line in f.readlines():
14 | if '>' == line[0]:
15 | count += 1
16 | if count == 3:
17 | p.close()
18 | break
19 | p.write(line)
20 | f.close()
--------------------------------------------------------------------------------
/data_process/txt/txt_save.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: np.savetxt() 参考:https://www.cnblogs.com/lindaxin/p/8392956.html
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-04-13 18:12:31
7 | LastEditTime: 2021-04-13 18:33:08
8 | FilePath: /Python/data_process/txt/txt_save.py
9 | '''
10 | import numpy as np
11 | l1=np.arange(5)
12 | l2,l3=l1*2,l1*3
13 | data = [[ 0., 1., 2., 3., 4.],
14 | [ 0., 2., 4., 6., 8.],
15 | [ 0., 3., 6., 9., 12.]]
16 | # np.savetxt('/home/hcq/pointcloud/Python/data_process/txt/test.txt', (l1,l2,l3), fmt="%.18f,%.18f,%.18f,%.18f,%.18f", delimiter="\n")
17 | np.savetxt('/home/hcq/pointcloud/Python/data_process/txt/test.txt', data, fmt="%.18f,%.18f,%.18f,%.18f,%.18f", delimiter="\n")
18 | # 第一个参数可以指定保存的路径以及文件名,注意指定的文件路径必须存在,它不会为你新建新的文件,会报错。fmt="%.18f,%.18f"指定保存的文件格式,delimiter="\n"表示分隔符
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/code/0131.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/code/0131.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/code/0153.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/code/0153.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/code/0161.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/code/0161.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/code/0178.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/code/0178.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/code/0398.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/code/0398.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/images/Girl.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/images/Girl.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/images/cat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/images/cat.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/images/dao2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/data/images/dao2.jpg
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/inception_model/imagenet_2012_challenge_label_map_proto.pbtxt:
--------------------------------------------------------------------------------
1 | # -*- protobuffer -*-
2 | # LabelMap from ImageNet 2012 full data set UID to int32 target class.
3 |
4 | entry {
5 | target_class: 449
6 | target_class_string: "n01440764"
7 | }
8 | entry {
9 | target_class: 450
10 | target_class_string: "n01443537"
11 | }
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/data/inception_model/imagenet_synset_to_human_label_map.txt:
--------------------------------------------------------------------------------
1 | n01440764 organism, being
2 | n01443537 benthos
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010001.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0203 1.4728 4.5571 -9.8629 -3.4482 0.7126 -3.1313 0.8013
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9974 1.5271 4.6837 -25.5370 4.3431 0.5905 -0.0123 0.7337
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0020 1.5383 4.7955 -49.0771 4.3163 0.5325 0.0107 0.4435
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9762 1.5113 4.6255 -59.3418 8.0768 0.3563 -0.0796 0.4417
5 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9518 1.5710 4.4827 -37.9043 6.8440 0.5145 -3.1252 0.4273
6 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.1362 2.3507 4.9544 61.6339 8.1660 1.0954 -3.1414 0.4060
7 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 3.0817 4.1654 11.1222 21.5555 -0.3200 2.2747 0.0745 0.4775
8 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7231 1.5347 1.6927 -31.1341 -13.6125 0.6233 0.0052 0.4536
9 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7401 1.5273 1.7450 33.3610 15.0280 0.1329 -3.1218 0.3489
10 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010002.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0552 1.4763 4.6480 -23.5360 -6.5318 0.7919 -0.5373 0.8198
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9675 1.4712 4.5437 1.3227 -10.0704 0.9193 -0.0056 0.7101
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9325 1.5617 4.5425 -12.4427 18.6532 0.3720 -1.7506 0.6818
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9825 1.6512 4.5770 -16.0288 -9.6545 1.0105 -0.0922 0.6703
5 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9669 1.5614 4.6158 -29.9153 13.0689 0.4663 -3.1083 0.6361
6 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9277 1.6774 4.4746 -7.3881 14.0600 0.5460 -1.7876 0.6300
7 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9568 1.4562 4.6437 -37.1092 13.1793 0.3444 -3.1219 0.6129
8 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8521 1.4237 4.4030 9.8751 -10.1672 0.9437 -3.0383 0.5639
9 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9024 1.4641 4.5169 -24.4253 12.9127 0.4298 -3.1271 0.5367
10 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9780 1.4671 4.6421 -18.8221 13.1700 0.4167 -0.0664 0.5209
11 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8957 1.4787 4.5103 -9.1745 29.8330 0.0541 -1.8139 0.5089
12 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9065 1.5217 4.5462 -1.1303 37.3721 0.1158 -1.9620 0.5036
13 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9002 1.4517 4.5823 -26.9719 -12.2918 0.8792 -1.4396 0.5031
14 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9540 1.4647 4.5548 25.3027 13.1638 0.6849 -0.0476 0.4959
15 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9024 1.5400 4.5609 -20.4088 -16.0821 1.0924 -1.4285 0.4896
16 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9155 1.4177 4.4629 17.5604 -10.3906 1.0578 -0.1145 0.4402
17 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8661 1.4400 4.3788 14.4543 13.0571 0.5686 -0.1738 0.4354
18 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9183 1.5019 4.5226 -53.8140 12.9507 0.3570 -0.0259 0.4337
19 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9441 1.6074 4.6720 -59.8619 13.1150 0.4481 -0.0264 0.4279
20 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9614 1.6611 4.5938 41.8219 13.1157 0.7604 -0.0158 0.4097
21 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9152 1.4383 4.5543 3.8795 13.1716 0.4878 -0.0269 0.4067
22 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8446 1.5396 4.4429 -42.4413 -9.9650 0.7958 -0.0110 0.3860
23 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9131 1.4705 4.4985 -6.1183 19.3345 0.2631 -1.8471 0.3793
24 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8842 1.7348 4.4904 -36.7169 -10.0554 0.9375 -3.1241 0.3784
25 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.1325 2.0990 5.0582 -72.9121 5.3578 0.6362 -3.1300 0.3560
26 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9012 1.5828 4.5605 -48.3641 -10.0683 0.8856 -3.0739 0.3473
27 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8578 1.4887 4.4203 -4.6431 25.0117 0.1475 -1.8359 0.3378
28 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8454 1.6705 4.3912 35.5561 12.9324 0.7663 -3.1342 0.3374
29 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9325 1.4717 4.5386 51.3034 13.2577 0.6240 -3.1174 0.3301
30 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9359 1.7358 4.5802 79.7746 -10.3299 1.4639 3.0269 0.3281
31 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8342 1.4838 4.4923 -43.2797 13.6541 0.3838 -0.0206 0.3218
32 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9246 1.6671 4.5761 53.1425 -9.8257 1.0240 3.1207 0.3204
33 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9174 1.5359 4.6010 -74.8981 13.7318 0.1905 -0.0567 0.3124
34 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8612 1.4408 4.4746 -7.9960 35.7910 -0.0680 -1.8128 0.3009
35 | Tricar 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.1866 1.7614 2.6365 -25.8111 -25.0794 1.2889 0.6379 0.3531
36 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7196 1.4653 1.6943 16.8862 6.0272 0.6677 -3.1337 0.6433
37 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7326 1.2084 1.7367 -10.6244 -13.5415 0.9850 -3.0945 0.4772
38 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7271 1.5586 1.6878 16.6543 -3.7580 0.8677 -3.0998 0.4585
39 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7182 1.4980 1.6963 6.5950 10.5278 0.6143 3.1229 0.4091
40 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7543 1.5950 1.6926 47.6124 -3.0897 1.0408 0.0253 0.3301
41 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6530 1.1457 1.6917 14.6309 17.8872 0.6163 1.5118 0.3237
42 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6950 1.1438 1.6841 11.1303 13.1773 0.3815 1.6702 0.3226
43 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6744 1.0989 1.6889 -2.9203 -10.3285 0.8919 3.0876 0.3129
44 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6703 1.1247 1.6647 -5.2334 -9.8758 0.8259 1.8769 0.3098
45 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6917 1.2053 1.7142 27.1044 -10.0478 0.9271 1.4680 0.3060
46 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6314 1.0568 1.6327 14.0845 -10.2780 0.8880 1.5512 0.3002
47 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010003.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0985 1.5930 4.7376 -28.1494 0.4539 0.8060 -0.0172 0.7473
2 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.2882 2.3634 5.9180 35.1670 -0.7327 1.2567 0.0343 0.4251
3 | Tricar 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.3104 1.6163 3.2781 44.2567 -3.5693 0.9445 -0.0086 0.6025
4 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7840 1.5878 1.7525 42.3066 15.4756 0.3598 0.0225 0.3077
5 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010004.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9445 1.4590 4.5409 -14.4305 13.8291 0.3292 3.1247 0.7820
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0287 1.4719 4.6080 -13.1457 1.0050 0.6908 -0.0578 0.7217
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0783 1.6249 4.6367 25.9670 0.1476 1.0203 -3.0977 0.6991
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9434 1.6121 4.5315 -6.9690 -10.4857 0.7748 -0.0853 0.6917
5 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9770 1.4561 4.5224 41.7074 -2.7261 1.0449 3.1166 0.6854
6 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8604 1.4921 4.4621 -11.9719 -10.1724 0.6804 -0.0571 0.6100
7 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9620 1.4953 4.5756 -75.0401 11.1970 0.0251 -3.1127 0.5876
8 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0945 1.9339 4.7727 6.6145 7.6840 0.9690 -3.0446 0.5677
9 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9702 1.4383 4.5266 40.9997 -5.2867 1.0369 -0.0065 0.5417
10 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9677 1.9541 4.6454 -30.9455 -16.6463 0.6948 -3.1098 0.5263
11 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8805 1.4625 4.4863 9.8036 -16.0024 0.8043 1.5835 0.4620
12 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.2591 2.3974 5.0947 56.1298 18.0049 1.2044 -3.1168 0.4618
13 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9191 1.5620 4.5776 -58.2450 0.5759 0.4274 -0.1167 0.4524
14 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8843 1.5397 4.5371 12.8261 -17.0600 0.8990 1.5613 0.4438
15 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9626 1.8353 4.6683 -29.3724 -11.8770 0.7306 0.0145 0.4128
16 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9152 1.5397 4.5036 -72.2981 -0.2447 0.3311 -0.0877 0.3871
17 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9327 1.5125 4.6421 15.7061 -17.5341 1.0189 -1.4180 0.3574
18 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9445 1.5005 4.5623 49.7953 -1.6346 1.0555 3.1368 0.3523
19 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.8945 3.3650 9.8972 61.7419 -5.0885 2.0902 0.0565 0.6594
20 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.7945 2.8159 8.9968 63.4290 25.3786 1.2111 -3.0204 0.5796
21 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.4795 2.3809 6.7703 -23.2096 -2.1891 1.1348 -0.0807 0.4622
22 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.8540 1.6335 1.7970 2.6227 -8.3857 0.9305 3.0521 0.4367
23 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7313 1.5476 1.6958 41.7635 20.2568 0.6079 -3.1015 0.3015
24 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010005.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.1018 1.7906 4.7467 12.0510 0.0009 0.8957 -0.0115 0.5299
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.2558 2.2404 5.1983 38.6213 4.6703 1.0998 0.6362 0.5156
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.7500 1.4542 4.3232 4.7874 12.3900 0.5420 3.0683 0.5125
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8933 1.5988 4.5052 31.4203 12.3954 0.6761 0.1220 0.3738
5 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8529 1.8521 4.4085 65.9208 5.2581 0.9727 -3.0118 0.3183
6 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8795 1.7082 4.6955 61.9056 12.4097 0.7003 0.0204 0.3143
7 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9719 1.8422 4.5269 58.6879 1.2061 1.2140 -3.0370 0.3043
8 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.2062 2.1844 5.8601 47.4711 12.1963 1.1162 0.0329 0.4489
9 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.2034 2.2380 5.5426 36.9499 -19.1403 1.4781 1.4863 0.3811
10 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010006.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9976 1.5144 4.5989 27.4228 -1.1227 0.9335 -2.9701 0.8001
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0332 1.7480 4.5766 8.4643 0.4916 0.8999 -3.1317 0.7448
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9304 1.5482 4.5228 -12.7485 3.4273 0.6590 -3.1231 0.6803
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0686 1.8816 4.7844 -11.8682 0.2135 0.8777 0.0222 0.5420
5 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.6067 3.1326 6.7183 -26.3633 3.3561 1.5225 -0.0126 0.4948
6 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.8404 2.8500 9.0923 -61.1185 -0.0559 1.5731 -3.0848 0.4178
7 | Tricar 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.2130 1.7745 2.6501 21.9330 8.9513 0.7716 -2.4663 0.4822
8 | Tricar 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.3026 1.8225 2.7054 26.2241 6.6109 0.8372 0.2863 0.4148
9 | Tricar 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.4072 1.6978 3.3130 -44.0693 -2.1196 0.7549 -0.0604 0.3436
10 | Tricar 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.3841 1.8229 3.1743 22.2438 11.8935 0.8118 0.8268 0.3410
11 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7923 1.5419 1.7686 25.3058 -7.8574 1.1264 -2.3256 0.5485
12 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7416 1.5258 1.6978 41.6889 -6.0362 1.0827 -2.6632 0.4826
13 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.8652 1.5338 1.8791 2.1467 4.8974 0.6342 -0.0154 0.4606
14 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7457 1.5800 1.7044 39.2838 13.6726 0.5033 -3.1064 0.3551
15 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7185 1.5892 1.6641 33.1682 3.8955 0.7880 -2.9417 0.3224
16 | Pedestrian 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6809 1.6638 0.6271 44.9250 12.5967 0.6205 3.0716 0.6236
17 | Pedestrian 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6858 1.6694 0.6191 14.1915 8.5465 0.6547 3.0352 0.6143
18 | Pedestrian 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7011 1.7130 0.6632 34.0705 -6.7426 1.2308 0.4045 0.5252
19 | Pedestrian 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6877 1.6946 0.6117 45.1599 -4.4378 1.2070 0.3600 0.4871
20 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010007.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0241 1.4750 4.5583 30.9552 -1.4645 0.8045 -3.1090 0.8049
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.1029 1.6887 4.7173 -31.4017 -3.6810 0.8633 0.0127 0.7971
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9564 1.5157 4.4876 4.4703 3.4059 0.7532 3.1328 0.7611
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0149 1.5803 4.5777 -33.4910 3.5767 0.7320 -3.1240 0.7498
5 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0096 1.7156 4.5903 -4.7839 -4.2341 0.8599 3.1302 0.7379
6 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0016 1.5337 4.5758 55.0836 0.6353 0.9029 0.0072 0.6344
7 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9922 1.6259 4.6889 12.2837 21.6569 -0.5684 3.0981 0.4855
8 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0287 1.7134 4.7672 -69.1311 -0.2461 0.6925 -3.1002 0.4721
9 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0296 1.5363 4.6912 -15.2365 3.7559 0.8062 -0.0066 0.3790
10 | Truck 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.3903 2.4003 6.3201 26.9436 19.7234 -0.0799 -3.1266 0.4225
11 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010008.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8189 1.4177 4.3734 -36.7765 12.0538 0.8686 0.0703 0.6490
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8986 1.4641 4.4285 -53.7288 -2.9442 1.1816 -0.0666 0.6049
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9046 1.4426 4.4338 -28.5189 12.0567 0.7679 -3.1170 0.5903
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9424 1.5114 4.5921 68.3825 34.7858 -0.2123 -3.1286 0.5896
5 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9347 1.5147 4.5424 -63.3098 11.8294 1.1766 -3.1359 0.4601
6 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9615 1.5217 4.5954 -57.4238 11.5885 1.1544 -0.0169 0.4594
7 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9156 1.4771 4.5305 71.9226 28.4257 0.0036 -1.8467 0.4513
8 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9329 1.5391 4.6172 79.0671 27.7751 0.0297 -1.8046 0.4510
9 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9068 1.7580 4.4647 69.1104 29.9352 0.0867 -1.7086 0.3785
10 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9493 1.6451 4.6621 74.8138 41.4109 -0.0025 -1.9923 0.3769
11 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.1053 1.9531 5.0313 -63.7188 35.0166 0.8514 -0.3397 0.3416
12 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0101 1.6516 4.8129 71.2819 21.5020 0.2276 -1.0815 0.3260
13 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8303 1.5185 4.3901 78.5169 35.7275 -0.0959 -1.0790 0.3124
14 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6991 1.2225 1.7327 -14.6048 16.2889 0.4067 1.5167 0.4586
15 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7322 1.3340 1.7404 -17.4669 13.7644 0.5301 -0.4067 0.4108
16 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7418 1.5048 1.7383 7.5660 23.6576 0.4004 -0.6915 0.4054
17 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6748 1.2000 1.7419 -12.8810 16.2140 0.4041 1.5688 0.3906
18 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6837 1.1305 1.6756 -15.5034 16.3339 0.4194 -1.7041 0.3810
19 | Pedestrian 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7059 1.7067 0.6650 4.4403 20.0143 0.6231 0.3989 0.5807
20 | Pedestrian 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7227 1.6890 0.6795 50.6423 -39.2818 1.6963 -2.2711 0.3194
21 | Pedestrian 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.6960 1.6349 0.6845 13.0206 -33.4182 1.7487 1.1023 0.3027
22 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/predictions/010009.txt:
--------------------------------------------------------------------------------
1 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 2.0458 1.7306 4.6224 11.3200 0.1376 0.7913 -0.0065 0.3894
2 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9288 1.6422 4.6273 40.5218 5.2813 0.5275 -1.5918 0.3759
3 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.8921 1.6554 4.4955 8.0039 -33.8067 1.3878 -3.1252 0.3534
4 | Car 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 1.9788 1.9111 4.7759 -4.9938 -37.7167 1.8079 -1.4243 0.3170
5 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7585 1.5584 1.7150 -23.3410 15.5383 0.6502 0.0346 0.4159
6 | Cyclist 0.0000 0 0.0000 -1.0000 -1.0000 -1.0000 -1.0000 0.7348 1.5486 1.7089 29.2817 15.6866 0.1697 3.0988 0.3864
7 |
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/reslut.pkl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/reslut.pkl
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/transfer.py:
--------------------------------------------------------------------------------
1 | '''
2 | @Description:
3 | @Author: HCQ
4 | @Company(School): UCAS
5 | @Date: 2020-07-30 08:08:43
6 | @LastEditors: HCQ
7 | @LastEditTime: 2020-07-30 12:20:37
8 | '''
9 | import _pickle as pickle
10 |
11 | # f = open('dict_word.pkl', 'rb')
12 | # for line in f:
13 | # print(line)
14 |
15 | # word = pickle.load(open("preditions.pkl", 'rb'), encoding='utf-8')
16 | # print(word)
17 |
18 | # D = {
19 | # 'name': 'bob',
20 | # 'major': {
21 | # 'english',
22 | # 'math'
23 | # },
24 | # 'd': [1, 2, 3, 4, 5, 6, 7]
25 | # }
26 |
27 | D = {
28 | 'name': ['Car',],
29 | 'truncated':[0.,],
30 | 'occluded':[0,],
31 | 'alpha':[0,],
32 | 'bbox':[-1,-1,-1,-1],
33 | 'dimensions':[4.5676007,2.041592,1.6213634],
34 | 'location':[2.752196,-6.6567035,0.7322118],
35 | 'rotation_y':[0.0485813, ],
36 | 'score':[0.5716194,],
37 | 'metadata':
38 | {
39 | 'image_prefix': '/home/ma-user/work/workspace/DeepCamp_Lidar',
40 | 'num_point_features': 4,
41 | 'image_idx':'009001',
42 | 'token':'009001'
43 | }
44 | }
45 |
46 | with open('D.pkl', 'ab+') as f:
47 | pickle.dump(D, f)
48 |
49 |
50 | # word = pickle.load(open("D.pkl", 'rb'), encoding='utf-8')
51 | # print(word)
52 |
53 |
54 | # 读取
55 | with open('D.pkl','rb') as f:
56 | while True:
57 | try:
58 | aa = pickle.load(f)
59 | print(aa)
60 | except EOFError:
61 | break
62 |
63 |
64 | # word = pickle.load(open("result.pkl", 'rb'), encoding='utf-8')
65 | # print(word)
--------------------------------------------------------------------------------
/data_process/txt/txt转换pkl/txt_to_pkl txt转换pkl/txt_to_pkl.py:
--------------------------------------------------------------------------------
1 | '''
2 | @Description:
3 | @Author: HCQ
4 | @Company(School): UCAS
5 | @Date: 2020-07-30 08:25:11
6 | @LastEditors: HCQ
7 | @LastEditTime: 2020-07-30 13:58:04
8 | '''
9 | import os
10 | import numpy as np
11 | import _pickle as pickle
12 |
13 | # def multiple_replace(file):
14 | # """
15 | # read file
16 | # if find
17 | # replace
18 | # write to file
19 | # """
20 | # f = open(file, "r+")
21 | # text = f.readlines()
22 | # f.seek(0)
23 | # f.truncate()
24 | # for line in text:
25 | # line = line.replace('Pedestrian','1')
26 | # line = line.replace('Car', '2')
27 | # line = line.replace('Cyclist', '3')
28 | # line = line.replace('Truck', '4')
29 | # line = line.replace('Tricar', '5')
30 | # f.write(line)
31 | # f.close()
32 |
33 | root_dir='predictions'
34 | filename = os.listdir(root_dir)
35 | file_number = len(filename)
36 | li= []
37 | for i in range(1):
38 | dets_path = os.path.join('predictions', filename[i][:-4] + '.txt')
39 | # print(dets_path)
40 | # multiple_replace(dets_path)
41 | f = open(dets_path, "r+")
42 | text = f.readlines()
43 | for line in text:
44 | list1 = line.split()
45 |
46 | data = {
47 | 'name': [list1[0],],
48 | 'truncated':[list1[1],],
49 | 'occluded':[list1[2],],
50 | 'alpha':[list1[3],],
51 | 'bbox': list(map(float,list1[4:8])),# 字符串数组转为数字数组
52 | 'dimensions':list1[8:11],
53 | 'location':list1[11:14],
54 | 'rotation_y':[list1[14], ],
55 | 'score':[list1[15],],
56 | 'metadata':
57 | {
58 | 'image_prefix': '/home/ma-user/work/workspace/DeepCamp_Lidar',
59 | 'num_point_features': 4,
60 | 'image_idx': filename[i][:-4],
61 | 'token': filename[i][:-4]
62 | }
63 | }
64 | # print(data)
65 |
66 | li.append(data)
67 | print(li)
68 | print(len(li))
69 | with open('reslut.pkl', 'ab+') as f:
70 | pickle.dump(li, f)
71 | # # 读取
72 | # with open('reslut.pkl','rb') as f:
73 | # while True:
74 | # try:
75 | # aa = pickle.load(f)
76 | # print(aa)
77 | # except EOFError:
78 | # break
--------------------------------------------------------------------------------
/data_process/txt/读取文件名并生成txt文件.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description:
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-10-22 10:06:47
7 | LastEditTime: 2022-03-21 14:13:20
8 | FilePath: /Python/data_process/txt/读取文件名并生成txt文件.py
9 | '''
10 |
11 | import os
12 |
13 |
14 | class ReadImageName():
15 | def __init__(self):
16 | self.path = '/home/hcq/data/2022anno/finaul_result/txt_result'
17 |
18 | def readname(self):
19 | filenames = os.listdir(self.path)
20 | flielist = []
21 |
22 | for item in filenames:
23 | if item.endswith('.txt'):
24 | # itemname = os.path.join(self.path, item) # '/home/hcq/data/test_anno_2021-08-02-10-22-25_bag试标结果/试标结果/点云追踪结果/源文件/test_anno_2021-08-02-10-22-25_bag/000009.jpg'
25 | # itemname = itemname[-11:] #
26 | # flielist.append(itemname) # 000001 saved
27 | flielist.append(item[0:6]) # 000001 saved
28 | # sort
29 | flielist = [int(x) for x in flielist]
30 | flielist.sort() #
31 | flielist = ['%06d'%x for x in flielist] # 数字转成字符
32 | # save
33 | fo = open("filename.txt", "w")
34 | for item in flielist:
35 | fo.write(str(item) + "\n")
36 |
37 |
38 | if __name__ == '__main__':
39 | log = ReadImageName()
40 | log.readname()
--------------------------------------------------------------------------------
/data_process/yaml/yaml.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": null,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": []
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "## 读取 yaml"
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": null,
20 | "metadata": {},
21 | "outputs": [],
22 | "source": []
23 | },
24 | {
25 | "cell_type": "markdown",
26 | "metadata": {},
27 | "source": [
28 | "## ## 保存yaml"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": null,
34 | "metadata": {},
35 | "outputs": [],
36 | "source": []
37 | }
38 | ],
39 | "metadata": {
40 | "kernelspec": {
41 | "display_name": "Python 3.8.13 ('pcdet')",
42 | "language": "python",
43 | "name": "python3"
44 | },
45 | "language_info": {
46 | "name": "python",
47 | "version": "3.8.13"
48 | },
49 | "orig_nbformat": 4,
50 | "vscode": {
51 | "interpreter": {
52 | "hash": "4a4bb52955cb4b7ba3167560f52fbe8257746766a280283c0daccbe36f0c9125"
53 | }
54 | }
55 | },
56 | "nbformat": 4,
57 | "nbformat_minor": 2
58 | }
59 |
--------------------------------------------------------------------------------
/filename.txt:
--------------------------------------------------------------------------------
1 | 000004
2 | 000005
3 | 000006
4 | 000007
5 | 000008
6 | 000009
7 | 000010
8 | 000011
9 | 000012
10 | 000013
11 | 000014
12 | 000015
13 | 000016
14 | 000017
15 | 000030
16 | 000031
17 | 000032
18 | 000033
19 | 000034
20 |
--------------------------------------------------------------------------------
/my file.txt:
--------------------------------------------------------------------------------
1 | This is my first line.
2 | This is my next line.
3 | This is a appended file
4 | This is a appended file
--------------------------------------------------------------------------------
/pickle_example.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/pickle_example.pickle
--------------------------------------------------------------------------------
/project-details/00 小trick.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "language_info": {
4 | "codemirror_mode": {
5 | "name": "ipython",
6 | "version": 3
7 | },
8 | "file_extension": ".py",
9 | "mimetype": "text/x-python",
10 | "name": "python",
11 | "nbconvert_exporter": "python",
12 | "pygments_lexer": "ipython3",
13 | "version": 3
14 | },
15 | "orig_nbformat": 2,
16 | "kernelspec": {
17 | "name": "python_defaultSpec_1596953155937",
18 | "display_name": "Python 3.5.4 64-bit"
19 | }
20 | },
21 | "nbformat": 4,
22 | "nbformat_minor": 2,
23 | "cells": [
24 | {
25 | "cell_type": "markdown",
26 | "metadata": {},
27 | "source": [
28 | "## 01 for循环生成数组(生成验证码)"
29 | ]
30 | },
31 | {
32 | "cell_type": "code",
33 | "execution_count": 1,
34 | "metadata": {
35 | "tags": []
36 | },
37 | "outputs": [
38 | {
39 | "output_type": "stream",
40 | "name": "stdout",
41 | "text": "['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']\n['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']\n"
42 | }
43 | ],
44 | "source": [
45 | "number = [str(i) for i in range(10)]\n",
46 | "little = [chr(i) for i in range(97,123)]\n",
47 | "large = [chr(i) for i in range(65,91)]\n",
48 | "print(number)\n",
49 | "print(little)\n",
50 | "print(large)"
51 | ]
52 | },
53 | {
54 | "cell_type": "markdown",
55 | "metadata": {},
56 | "source": [
57 | "## choice(['red','green'],size=10) 随机生成指定内容"
58 | ]
59 | },
60 | {
61 | "cell_type": "code",
62 | "execution_count": 8,
63 | "metadata": {
64 | "tags": []
65 | },
66 | "outputs": [
67 | {
68 | "output_type": "stream",
69 | "name": "stdout",
70 | "text": "['red' 'red' 'green' 'red' 'green' 'green' 'red' 'green' 'green' 'green']\nredredgreenredgreengreenredgreengreengreen\n"
71 | }
72 | ],
73 | "source": [
74 | "from numpy.random import choice\n",
75 | "\n",
76 | "colors = choice(['red','green'],size=10)\n",
77 | "print(colors)\n",
78 | "print(''.join(colors)) # 转为字符串"
79 | ]
80 | },
81 | {
82 | "cell_type": "markdown",
83 | "metadata": {},
84 | "source": [
85 | "## 补40个零 `[0] * n_inputs`"
86 | ]
87 | },
88 | {
89 | "cell_type": "code",
90 | "execution_count": 13,
91 | "metadata": {
92 | "tags": []
93 | },
94 | "outputs": [
95 | {
96 | "output_type": "stream",
97 | "name": "stdout",
98 | "text": "[1, 5, 9, [0, 0, 0, 0, 0]]\n"
99 | }
100 | ],
101 | "source": [
102 | "import numpy as np\n",
103 | "# 填充0\n",
104 | "tr_data = []\n",
105 | "mfccs =[1,5,9]\n",
106 | "n_inputs = 5 # 补零\n",
107 | "mfccs.append([0] * n_inputs) \n",
108 | "print(mfccs)"
109 | ]
110 | },
111 | {
112 | "cell_type": "markdown",
113 | "metadata": {},
114 | "source": [
115 | "## 取多层数组维度最长的长度"
116 | ]
117 | },
118 | {
119 | "cell_type": "code",
120 | "execution_count": 4,
121 | "metadata": {
122 | "tags": []
123 | },
124 | "outputs": [
125 | {
126 | "output_type": "stream",
127 | "name": "stdout",
128 | "text": "4\n"
129 | }
130 | ],
131 | "source": [
132 | "tr_features = [[1,2,5,9] , [1,6]] # len分别是4和2\n",
133 | "wav_max_len = max([len(feature) for feature in tr_features])\n",
134 | "print(wav_max_len)"
135 | ]
136 | },
137 | {
138 | "cell_type": "code",
139 | "execution_count": null,
140 | "metadata": {},
141 | "outputs": [],
142 | "source": []
143 | }
144 | ]
145 | }
--------------------------------------------------------------------------------
/project-details/00path/02path-os-details.py:
--------------------------------------------------------------------------------
1 | '''
2 | @Description:
3 | @Author: HCQ
4 | @Company(School): UCAS
5 | @Date: 2020-07-20 22:30:12
6 | @LastEditors: HCQ
7 | @LastEditTime: 2020-07-25 00:30:02
8 | '''
9 | # 参考:记录下os.path.dirname(__file__)使用 https://blog.csdn.net/JOJOY_tester/article/details/54598713
10 |
11 | # 在运行的时候如果输入完整的执行的路径,则返回.py文件的全路径如:Python c:/test/test.py 则返回路径 c:/test ,如果是python test.py 则返回空;
12 | # os.path.abspath(__file__)返回的是.py文件的绝对路径
13 |
14 | import os
15 | import sys
16 | #该文件所在位置:D:\第1层\第2层\第3层\第4层\第5层\test11.py
17 |
18 | path1 = os.path.dirname(__file__)
19 | print(path1)#获取当前运行脚本的绝对路径 f:\Github\Python\project-details
20 |
21 | path2 = os.path.dirname(os.path.dirname(__file__)) #
22 | print(path2)#获取当前运行脚本的绝对路径(去掉最后一个路径) f:\Github\Python
23 |
24 | path3 = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
25 | print(path3)#获取当前运行脚本的绝对路径(去掉最后2个路径)f:\Github
26 |
27 | path4 = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
28 | print(path4)#获取当前运行脚本的绝对路径(去掉最后3个路径)
29 |
30 | path5 = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
31 | print(path5)#获取当前运行脚本的绝对路径(去掉最后4个路径)
32 |
33 | path6 = os.__file__ #获取os所在的目录
34 | print(path6) # D:\ProgramData\Anaconda3\lib\os.py
35 | path7 = os.path.abspath(__file__) # 返回的是.py文件的绝对路径。
36 | print(path7) #
37 |
38 | # 项目中
39 | BASE_DIR = os.path.dirname(os.path.abspath(__file__))
40 | sys.path.append(BASE_DIR)
41 | print("sys.path: ", sys.path) # sys.path是一个数组
42 |
43 | DATA_DIR = os.path.join(BASE_DIR, 'data') # 在本目录新建data文件夹 "f:\Github\Python\project-details\data"
44 | print("DATA_DIR \n", DATA_DIR)
45 | www = 'https://shapenet.cs.stanford.edu/media/modelnet40_ply_hdf5_2048.zip'
46 | zipfile = os.path.basename(www) # 获得文件名modelnet40_ply_hdf5_2048
47 | print('zipfile', zipfile)
48 | # os.system 运行linux命令
49 | # os.system('wget --no-check-certificate %s; unzip %s' % (www, zipfile))
50 |
51 |
52 | v_f = os.path.join(os.path.dirname(os.path.abspath(__file__)), "/home/cjm/Desktop/Deecamp/workspace/DeepCamp_Lidar/test_video_filter")
53 | print("==========v_f==================")
54 | print(v_f)
55 |
--------------------------------------------------------------------------------
/project-details/00path/03移动文件到另一个目录extract.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: 移动文件到另一个目录
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-08-17 16:16:58
7 | LastEditTime: 2021-08-18 17:56:04
8 | FilePath: /Python/project-details/00path/extract.py
9 | '''
10 | import os
11 | import shutil
12 | from tqdm import tqdm
13 | def main():
14 | lis = os.listdir('./')
15 | folders = []
16 | '''find root folders'''
17 | for i in lis:
18 | if 'py' not in i:
19 | folders.append(i)
20 | '''start looping'''
21 | for folder in tqdm(folders):
22 | path = './' + folder + '/'
23 | bags = os.listdir(path)
24 | for bag in bags:
25 | bag_path = path+bag+'/'
26 |
27 | types = ['image/', 'pointcloud/os_cloud_node/']
28 | for t in types:
29 | if os.path.exists(bag_path+t):
30 | files = os.listdir(bag_path+t)
31 | for file in files:
32 | shutil.move(bag_path+t+ file, bag_path) #move images
33 | else:
34 | print('cannot find {} folder at {}'.format(t, bag_path))
35 |
36 | # if os._exists(bag_path+'os_cloud_node'):
37 |
38 |
39 |
40 |
41 | if __name__ == '__main__':
42 | main()
--------------------------------------------------------------------------------
/project-details/00path/04_01删除文件filter.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: # 遍历文件并删除指定文件(只保存pcd的,不要只带有jpg的)
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-08-18 19:29:19
7 | LastEditTime: 2021-08-18 20:11:31
8 | FilePath: /Python/project-details/00path/04_01删除文件filter.py
9 | '''
10 | import os
11 | import shutil
12 | from tqdm import tqdm
13 | def filter(path):
14 | roots = os.listdir(path)
15 | folders = []
16 | '''bfs traverse the folders'''
17 | for i in roots:
18 | if 'py' not in i:
19 | folders.append(i)
20 |
21 | for folder in tqdm(folders):
22 | folder_path = path+'/'+folder+'/'
23 | second = os.listdir(folder_path)
24 | for s in second:
25 | second_path = folder_path+s+'/'
26 | bags = os.listdir(second_path)
27 | black_list = []
28 | for bag in bags:
29 | bag_path = second_path+bag+'/'
30 | files = os.listdir(bag_path)
31 | files = ''.join(files)
32 | if('pcd' not in files):
33 | black_list.append(bag_path)
34 |
35 | # for l in black_list:
36 | # shutil.rmtree(l)
37 |
38 | print('process finished')
39 |
40 | if __name__ == '__main__':
41 | filter('/media/hcq/hcq4T/huituo_data_collection/detection/ouster_bagfile_extract/shenbao')
42 |
43 |
44 |
--------------------------------------------------------------------------------
/project-details/00path/04遍历删除目标文件error.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: 删除命令: shutil.rmtree(rm_path)
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-08-18 17:54:55
7 | LastEditTime: 2021-08-18 18:24:09
8 | FilePath: /Python/project-details/00path/04遍历删除目标文件.py
9 | '''
10 |
11 | #!/usr/bin/python
12 | # -*- coding: UTF-8 -*-
13 |
14 | import os
15 | import shutil
16 | import tqdm as tqdm
17 |
18 |
19 | def remove_files_by_folder(folder_path):
20 | # 遍历文件并删除制定文件
21 | dataset_dirs = folder_path
22 | img_list = []
23 | for dataset_dir in dataset_dirs:
24 | for root,dirs,files in os.walk(dataset_dir): # #当前目录路径 、#当前路径下所有子目录 数组 和#当前路径下所有非目录子文件
25 | # print(root,dirs) # dirs = ['1', '2', '3', '4', '5', '6', '7']
26 | # print("files:", files) # #当前路径下所有非目录子文件
27 | files = ''.join(files)
28 | if "pcd" in files:
29 | print("not remove")
30 | else:
31 | shutil.rmtree(rm_path)
32 | for file in files:
33 | if(file.split(".")[-1]== "jpg"): # 判断bag]包
34 | print(os.path.join(root,file))
35 | rm_path = os.path.join(root,file)
36 | img_list.append(os.path.join(root,file))
37 | # 删除
38 | shutil.rmtree(rm_path)
39 |
40 | if __name__ == '__main__':
41 | folder_path = ['/media/hcq/hcq4T/huituo_data_collection/detection/ouster_bagfile_extract/shenbao']
42 | # folder_path = ['/media/hcq/hcq4T/huituo_data_collection/detection/ouster_bagfile_extract/shenbao'] # 20210705Detection_zhunnneg detection_yimin
43 | remove_files_by_folder(folder_path)
44 |
--------------------------------------------------------------------------------
/project-details/01lr_decays.py:
--------------------------------------------------------------------------------
1 | '''
2 | @Description:
3 | @Author: HCQ
4 | @Company(School): UCAS
5 | @Date: 2020-06-16 17:19:20
6 | @LastEditors: HCQ
7 | @LastEditTime: 2020-07-20 22:35:44
8 | '''
9 | max_epoch = 20
10 | # lr_decays = {i: 0.1**(1/100) for i in range(1, max_epoch)}
11 | # print(lr_decays)
12 | lr_decays = {i: 0.1 ** (1 / 150) for i in range(1, max_epoch)}
13 | print(lr_decays)
14 | # 感觉这就是学习率衰减,比如 max_epoch=20 ,就是每次的lr_decays都是0.1**(1/100)
15 | # 感觉他这是测试调试用的,因为i值没有变化
16 | # https://github.com/HuguesTHOMAS/KPConv-PyTorch/issues/4
--------------------------------------------------------------------------------
/project-details/01nms/01nms.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description:
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-08-16 13:13:42
7 | LastEditTime: 2021-08-16 14:58:46
8 | FilePath: /Python/project-details/01nms/01nms.py
9 | '''
10 | import numpy as np
11 |
12 | # 我们自定义数据: 数据格式是[[xmin,ymin,xmax,ymax,scores]....]
13 | boxes=np.array([
14 | [100,100,210,210,0.72],
15 | [250,250,420,420,0.8],
16 | [220,220,320,330,0.92], # score最大
17 | [100,100,210,210,0.72], # 一样
18 | [230,240,325,330,0.81],
19 | [220,230,315,340,0.9]])
20 |
21 |
22 |
23 | def py_cpu_nms(dets, thresh):
24 | #首先数据赋值和计算对应矩形框的面积
25 | #dets的数据格式是dets[[xmin,ymin,xmax,ymax,scores]....]
26 |
27 | x1 = dets[:,0] # 第一列
28 | y1 = dets[:,1]
29 | x2 = dets[:,2]
30 | y2 = dets[:,3]
31 | areas = (y2-y1+1) * (x2-x1+1) # 框的面积 左上右下的位置还可以,左下右上的就不对
32 | scores = dets[:,4]
33 | print('areas ',areas)
34 | print('scores ',scores)
35 |
36 | #这边的keep用于存放,NMS后剩余的方框
37 | keep = []
38 |
39 | #取出分数从大到小排列的索引。.argsort()是从小到大排列,[::-1]是列表头和尾颠倒一下。
40 | index = scores.argsort()[::-1] #
41 | print("排好索引index", index, index[1:])
42 | #上面这两句比如分数[0.72 0.8 0.92 0.72 0.81 0.9 ]
43 | # 对应的索引index[ 2 5 4 1 3 0 ]记住是取出索引,scores列表没变。
44 |
45 | #index会剔除遍历过的方框,和合并过的方框。 对剩下的bbx,循环执行(2)和(3)直到所有的bbx均满足要求(即不能再移除bbx)
46 | while index.size >0:
47 | print(index.size) # 6
48 | #取出第一个方框进行和其他方框比对,看有没有可以合并的
49 | i = index[0] # 得分最高的下标 当是2 every time the first is the biggst, and add it directly
50 |
51 | #因为我们这边分数已经按从大到小排列了。
52 | #所以如果有合并存在,也是保留分数最高的这个,也就是我们现在那个这个
53 | #keep保留的是索引值,不是具体的分数。
54 | keep.append(i) # 存当前排名第一索引值,不是具体的分数。 ===
55 | print("保留的是索引值:", keep)
56 | print('x1',x1[i]) # xmin
57 | print("其他框的x1: ", x1[index[1:]]) # 其他框
58 |
59 | #计算交集的左上角和右下角
60 | #这里要注意,比如x1[i]这个方框的左上角x和所有其他的方框的左上角x的
61 | # max
62 | x11 = np.maximum(x1[i], x1[index[1:]]) # calculate the points of overlap
63 | y11 = np.maximum(y1[i], y1[index[1:]])
64 | # min
65 | x22 = np.minimum(x2[i], x2[index[1:]])
66 | y22 = np.minimum(y2[i], y2[index[1:]])
67 |
68 | print(x11,y11,x22,y22)
69 | #这边要注意,如果两个方框相交,X22-X11和Y22-Y11是正的。
70 | #如果两个方框不相交,X22-X11和Y22-Y11是负的,我们把不相交的W和H设为0.
71 | w = np.maximum(0, x22-x11+1)
72 | h = np.maximum(0, y22-y11+1)
73 |
74 | #计算重叠面积就是上面说的交集面积。不相交因为W和H都是0,所以不相交面积为0
75 | overlaps = w*h
76 | print('overlaps is',overlaps)
77 |
78 | #这个就是IOU公式(交并比)。
79 | #得出来的ious是一个列表,里面拥有当前方框和其他所有方框的IOU结果。
80 | ious = overlaps / (areas[i]+areas[index[1:]] - overlaps) # array([0.79664777, 0.70984056, 0.16573009, 0. , 0. ]) ,其中,0.16573009 被保留
81 | print('ious is',ious)
82 |
83 | #接下来是合并重叠度最大的方框,也就是合并ious中值大于thresh的方框
84 | #我们合并的操作就是把他们剔除,因为我们合并这些方框只保留下分数最高的。
85 | #我们经过排序当前我们操作的方框就是分数最高的,所以我们剔除其他和当前重叠度最高的方框
86 | #这里np.where(ious<=thresh)[0]是一个固定写法,返回下标。 当where内只有一个参数时,那个参数表示条件,当条件成立时,where返回的是每个符合condition条件元素的坐标,返回的是以元组的形式
87 | idx = np.where(ious<=thresh)[0] # 小于0.7阈值, 得到: array([2, 3, 4]) base: [ 2 5 4 1 3 0 ]
88 | print(idx)
89 |
90 | #把留下来框在进行NMS操作
91 | #这边留下的框是去除当前操作的框,和当前操作的框重叠度大于thresh的框
92 | #每一次都会先去除当前操作框,所以索引的列表就会向前移动移位,要还原就+1,向后移动一位
93 | index = index[idx+1] # because index start from 1 原始的index[ 2 5 4 1 3 0 ]
94 | print(index)
95 | return keep #
96 |
97 |
98 | # 运行并可视化
99 |
100 | import matplotlib.pyplot as plt
101 | # 可视化
102 | def plot_bbox(dets, c='k'):
103 | x1 = dets[:,0]
104 | y1 = dets[:,1]
105 | x2 = dets[:,2]
106 | y2 = dets[:,3]
107 |
108 | plt.plot([x1,x2], [y1,y1], c)
109 | plt.plot([x1,x1], [y1,y2], c)
110 | plt.plot([x1,x2], [y2,y2], c)
111 | plt.plot([x2,x2], [y1,y2], c)
112 | plt.title(" nms")
113 |
114 |
115 | plt.figure(1)
116 | ax1 = plt.subplot(1,2,1)
117 | ax2 = plt.subplot(1,2,2)
118 |
119 | plt.sca(ax1)
120 | plot_bbox(boxes,'k') # before nms
121 |
122 | keep = py_cpu_nms(boxes, thresh=0.7) # 输入boxes==============================================
123 | plt.sca(ax2)
124 | plot_bbox(boxes[keep], 'r')# after nms
125 |
126 | plt.show() # 显示图像
--------------------------------------------------------------------------------
/project-details/03 字符串数组转成数字数组.py:
--------------------------------------------------------------------------------
1 | '''
2 | @Description:
3 | @Author: HCQ
4 | @Company(School): UCAS
5 | @Date: 2020-07-30 11:59:14
6 | @LastEditors: HCQ
7 | @LastEditTime: 2020-07-30 12:12:38
8 | '''
9 |
10 | # 整数字符串 list(map(int,list1))
11 | list1 = ['-1', '-1', '-1', '-1']
12 | print(list(map(int,list1)) ) # ValueError: invalid literal for int() with base 10: '-1.0000'
13 | # 或者
14 | nums = [int(num) for num in list1]
15 |
16 | ## 小数 list(map(flaot,list1))
17 |
18 | list2 = ['-1.0000', '-1.0000', '-1.0000', '-1.0000']
19 | nums = [float(num) for num in list2]
20 | print(list(map(float,list2)))
21 | print(nums)
22 |
--------------------------------------------------------------------------------
/project-details/04 数据处理.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "language_info": {
4 | "codemirror_mode": {
5 | "name": "ipython",
6 | "version": 3
7 | },
8 | "file_extension": ".py",
9 | "mimetype": "text/x-python",
10 | "name": "python",
11 | "nbconvert_exporter": "python",
12 | "pygments_lexer": "ipython3",
13 | "version": 3
14 | },
15 | "orig_nbformat": 2
16 | },
17 | "nbformat": 4,
18 | "nbformat_minor": 2,
19 | "cells": [
20 | {
21 | "cell_type": "markdown",
22 | "metadata": {},
23 | "source": [
24 | "## txt文件组成词典(键值对) uid_to_human[uid] = human_string\n",
25 | "\n",
26 | "```txt\n",
27 | "n00004475\torganism, being\n",
28 | "n00005787\tbenthos\n",
29 | "n00006024\theterotroph\n",
30 | "n00006484\tcell\n",
31 | "```"
32 | ]
33 | },
34 | {
35 | "cell_type": "code",
36 | "execution_count": null,
37 | "metadata": {},
38 | "outputs": [],
39 | "source": [
40 | "uid_lookup_path = 'inception_model/imagenet_synset_to_human_label_map.txt' # 对应标签和集合\n",
41 | "uid_to_human={} # 定义一个字典\n",
42 | "# 一行一行读取数据\n",
43 | "for line in proto_as_ascii_lines:\n",
44 | " line = line.strip('\\n') # 去掉换行符\n",
45 | " parsed_items = line.split('\\t') # 按照tab符分割\n",
46 | " uid = parsed_items[0] # 获取分类编号\n",
47 | " human_string = parsed_items[1] # 获取分类名称\n",
48 | " uid_to_human[uid] = human_string # 保存编号字符串和分类名称的映射关系\n",
49 | "# print(uid_to_human)"
50 | ]
51 | },
52 | {
53 | "cell_type": "markdown",
54 | "metadata": {},
55 | "source": [
56 | "# 读取目录文件\n",
57 | "root,dirs,files\n",
58 | "* root 路径\n",
59 | "* dir 子目录\n",
60 | "* files 文件"
61 | ]
62 | },
63 | {
64 | "cell_type": "code",
65 | "execution_count": null,
66 | "metadata": {},
67 | "outputs": [],
68 | "source": [
69 | "# 遍历目录\n",
70 | "for root,dirs,files in os.walk('images/'):\n",
71 | " # 载入图片\n",
72 | " for file in files:\n",
73 | " image_data = tf.gfile.FastGFile(os.path.join(root,file),'rb').read()\n",
74 | " # 运行softmax节点,向其中feed值\n",
75 | " # 可以在网络中找到这个名字,DecodeJpeg/contents,\n",
76 | " # 据此可以发现,根据名字取网络中op时,如果其名字带括号,就用括号内的名字,如果不带括号,就用右上角介绍的名字。\n",
77 | " # 而带个0,是默认情况,如果网络中出现同名节点,这个编号会递增\n",
78 | " predictions = sess.run(softmax_tensor,{'DecodeJpeg/contents:0':image_data})\n",
79 | " predictions = np.squeeze(predictions)# 把结果转化为1维数据\n",
80 | "\n",
81 | " image_path = os.path.join(root, file)\n",
82 | " print(image_path)"
83 | ]
84 | }
85 | ]
86 | }
--------------------------------------------------------------------------------
/project-details/05 __str__() 方法.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: __str__() 方法 https://www.runoob.com/note/41154
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-03-11 14:44:40
7 | LastEditTime: 2021-03-11 14:45:06
8 | FilePath: /Python/project-details/05 __str__() 方法.py
9 | '''
10 | class Cat:
11 | """定义一个猫类"""
12 |
13 | def __init__(self, new_name, new_age):
14 | """在创建完对象之后 会自动调用, 它完成对象的初始化的功能"""
15 | # self.name = "汤姆"
16 | # self.age = 20
17 | self.name = new_name
18 | self.age = new_age # 它是一个对象中的属性,在对象中存储,即只要这个对象还存在,那么这个变量就可以使用
19 | # num = 100 # 它是一个局部变量,当这个函数执行完之后,这个变量的空间就没有了,因此其他方法不能使用这个变量
20 |
21 | def __str__(self):
22 | """返回一个对象的描述信息"""
23 | # print(num)
24 | return "名字是:%s , 年龄是:%d" % (self.name, self.age)
25 |
26 | def eat(self):
27 | print("%s在吃鱼...." % self.name)
28 |
29 | def drink(self):
30 | print("%s在喝可乐..." % self.name)
31 |
32 | def introduce(self):
33 | # print("名字是:%s, 年龄是:%d" % (汤姆的名字, 汤姆的年龄))
34 | # print("名字是:%s, 年龄是:%d" % (tom.name, tom.age))
35 | print("名字是:%s, 年龄是:%d" % (self.name, self.age))
36 |
37 | # 创建了一个对象
38 | tom = Cat("汤姆", 30)
39 | print(tom)
--------------------------------------------------------------------------------
/project-details/06shape&axis.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: shpae&axis
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2021-03-11 15:02:28
7 | LastEditTime: 2022-08-06 22:48:17
8 | FilePath: /Python/project-details/06shape&axis.py
9 | '''
10 |
11 | import numpy as np
12 |
13 | # shape
14 | a=np.array(
15 | [
16 | [ [1,2,3],
17 | [2,3,4]],
18 |
19 | [[2,3,4],
20 | [1,2,1]]
21 | ])
22 | print(a)
23 | # print(a.shape, a.shape[0]) # a.shape=(2,2,3),维度对应的下标为(0,1,2) 其中0维->1, 1->2 , 2->3
24 | # 以sum为例,先记住:axis=几,几对应的shape就消失,如axis=0,之后的shape为(2,3);axis=2,则变成(2,2)
25 |
26 | # axis
27 | b = np.sum(a, axis=0) # (2,3)
28 | print("axis=0: ",b)
29 | f = np.sum(a, axis=1)
30 | print("axis=1: ",f) # (2,1,3)
31 |
32 | d=[[1,2,3],[4,5,6]]
33 | print("二维数组:",d)
34 | c = np.sum(d, axis=0) # 第一行+第二行
35 | print(c)
36 |
37 |
--------------------------------------------------------------------------------
/project-details/07tanh.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# tanh\n",
8 | "https://vimsky.com/examples/usage/numpy-tanh-python.html"
9 | ]
10 | },
11 | {
12 | "cell_type": "code",
13 | "execution_count": 34,
14 | "metadata": {},
15 | "outputs": [
16 | {
17 | "name": "stdout",
18 | "output_type": "stream",
19 | "text": [
20 | "Input array : \n",
21 | " [0, 1.5707963267948966, 1.0471975511965976, 3.141592653589793]\n",
22 | "\n",
23 | "Tangent Hyperbolic values : \n",
24 | " [0. 0.91715234 0.78071444 0.99627208]\n"
25 | ]
26 | }
27 | ],
28 | "source": [
29 | " \n",
30 | "import numpy as np \n",
31 | "import math \n",
32 | " \n",
33 | "in_array = [0, math.pi / 2, np.pi / 3, np.pi] \n",
34 | "print (\"Input array : \\n\", in_array) \n",
35 | " \n",
36 | "tanh_Values = np.tanh(in_array) \n",
37 | "print (\"\\nTangent Hyperbolic values : \\n\", tanh_Values)"
38 | ]
39 | },
40 | {
41 | "cell_type": "code",
42 | "execution_count": 40,
43 | "metadata": {},
44 | "outputs": [
45 | {
46 | "name": "stdout",
47 | "output_type": "stream",
48 | "text": [
49 | "0.34909248729495124\n",
50 | "2.2975599250672945\n",
51 | "2.6466524123622457\n"
52 | ]
53 | }
54 | ],
55 | "source": [
56 | "# 反双曲正切(反函数)\n",
57 | "print(np.arctanh(0.99)-np.arctanh(0.98))\n",
58 | "print(np.arctanh(0.98))\n",
59 | "print(np.arctanh(0.99))\n"
60 | ]
61 | },
62 | {
63 | "cell_type": "code",
64 | "execution_count": 44,
65 | "metadata": {},
66 | "outputs": [
67 | {
68 | "name": "stdout",
69 | "output_type": "stream",
70 | "text": [
71 | "2.2975599250672945\n",
72 | "2.3234589250709146 0.9809999959088231\n",
73 | "diff: 0.02589900000362011\n"
74 | ]
75 | }
76 | ],
77 | "source": [
78 | "print(np.arctanh(0.98)) # 2.2975599250672945\n",
79 | "for x in np.arange(np.arctanh(0.98), np.arctanh(0.99), 0.000001)[::-1]:\n",
80 | " if(np.tanh(x)-0.98 <1e-3):\n",
81 | " print(x, np.tanh(x))\n",
82 | " print(\"diff:\", x -np.arctanh(0.98))\n",
83 | " break"
84 | ]
85 | },
86 | {
87 | "cell_type": "code",
88 | "execution_count": null,
89 | "metadata": {},
90 | "outputs": [],
91 | "source": []
92 | },
93 | {
94 | "cell_type": "code",
95 | "execution_count": 33,
96 | "metadata": {},
97 | "outputs": [
98 | {
99 | "name": "stdout",
100 | "output_type": "stream",
101 | "text": [
102 | "[2.29755993 2.29756093 2.29756193 ... 2.64664993 2.64665093 2.64665193]\n",
103 | "[2.64665193 2.64665093 2.64664993 ... 2.29756193 2.29756093 2.29755993]\n"
104 | ]
105 | }
106 | ],
107 | "source": [
108 | "print(np.arange(np.arctanh(0.98), np.arctanh(0.99), 0.000001))\n",
109 | "\n",
110 | "print(np.arange(np.arctanh(0.98), np.arctanh(0.99), 0.000001)[::-1])"
111 | ]
112 | },
113 | {
114 | "cell_type": "code",
115 | "execution_count": null,
116 | "metadata": {},
117 | "outputs": [],
118 | "source": []
119 | }
120 | ],
121 | "metadata": {
122 | "interpreter": {
123 | "hash": "6da98eacdef9d70d05690ff9a51cb11cd928be326ca4c66c5cb22400c3fb5833"
124 | },
125 | "kernelspec": {
126 | "display_name": "Python 3.6.12 64-bit ('common': conda)",
127 | "name": "python3"
128 | },
129 | "language_info": {
130 | "codemirror_mode": {
131 | "name": "ipython",
132 | "version": 3
133 | },
134 | "file_extension": ".py",
135 | "mimetype": "text/x-python",
136 | "name": "python",
137 | "nbconvert_exporter": "python",
138 | "pygments_lexer": "ipython3",
139 | "version": "3.6.12"
140 | },
141 | "orig_nbformat": 4
142 | },
143 | "nbformat": 4,
144 | "nbformat_minor": 2
145 | }
146 |
--------------------------------------------------------------------------------
/python27/Teaching.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # -*- coding: UTF-8 -*-
3 | '''
4 | Created on 2017��6��10��
5 |
6 | @author: Chongqing
7 | '''
8 | #print"HuangChongwing"
9 | import os
10 |
11 | print os.getcwd()
--------------------------------------------------------------------------------
/python27/app.py:
--------------------------------------------------------------------------------
1 | # -*- coding: UTF-8 -*-
2 | '''
3 | Created on 2017年8月15日
4 |
5 | @author: hasee
6 | '''
7 | import web
8 |
9 | urls = (
10 | '/', 'index'
11 | )
12 |
13 | app = web.application(urls, globals())
14 |
15 | class index:
16 | def GET(self):
17 | greeting = "Hello World"
18 | return greeting
19 |
20 | if __name__ == "__main__":
21 | app.run()
22 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/01安装.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/python3_tutorials_莫凡/01安装.py
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/02print().py:
--------------------------------------------------------------------------------
1 | >> > print(we are going to do sth)
2 | File "", line 1
3 | print(we are going to do sth)
4 | ^
5 | SyntaxError: invalid syntax
6 | >> > print('we are going to do sth')
7 | we are going to do sth
8 | >> > print("!I'm cq")
9 | !I'm cq
10 | >> > print('apple' + 'eat')
11 | appleeat
12 | >> > print('apple' + '4')
13 | apple4
14 | >> > print('apple' + str(4))
15 | apple4
16 | >> > print(int('1')+2)
17 | 3
18 | >> > print(complex(1))
19 | (1+0j)
20 | >> >
21 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/03数字.py:
--------------------------------------------------------------------------------
1 | # >> > 2 + 2
2 | # 4
3 | # >> > 2 - 2
4 | # 0
5 | # >> > 2 * 2
6 | # 4
7 | # >> > 2 / 2
8 | # 1.0
9 | # >> > 2 ** 2
10 | # 4
11 | # >> > 2 ** 3
12 | # 8
13 | # >> > 8 % 2
14 | # 0
15 | # >> > 9 % 4
16 | # 1
17 | # >> > 9/2
18 | # 4.5
19 | # >> > 9//2
20 | # 4
21 | # >> >
22 |
23 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/04自变量variable.py:
--------------------------------------------------------------------------------
1 | apple_fruit= 1
2 | print(apple_fruit)
3 |
4 | app_age = 2**4
5 | print(app_age)
6 |
7 | a = 1
8 | b = 2
9 | c = 3
10 | d=b**c
11 | print(a, b, c, d)
12 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/05while循环.py:
--------------------------------------------------------------------------------
1 | # condition = 1
2 | # while condition < 10:
3 | # print(condition)
4 | # condition += 1
5 |
6 | while True:
7 | print(1)
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/06for循环.py:
--------------------------------------------------------------------------------
1 | ''' example_list = [1, 3, 5, 7, 3, 7, 8, 2, 5, 7, 3563, 36446, 635] #列表 可改变
2 | for i in example_list:
3 | print(i)
4 |
5 | print("outer of for") '''
6 |
7 | # 内部函数
8 | # range(1,3) [1,2]
9 | for i in range(1, 10, 2):
10 | print(i)
11 |
12 | # 1
13 | # 3
14 | # 5
15 | # 7
16 | # 9
17 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/07_09if条件.py:
--------------------------------------------------------------------------------
1 | x = 1
2 | y = 2
3 | z = 3
4 |
5 | #07 #08if else
6 |
7 | # if x > y:
8 | # print("x is greater than y")
9 | # else:
10 | # print("x is less than y")
11 |
12 | # m = 1
13 | # n = 1
14 | # if m == n:
15 | # print("m is equal to n")
16 |
17 |
18 | # 09 if: elif: else:
19 |
20 |
21 | if x < y:
22 | print("x is less than y")
23 | elif x == y:
24 | print("x is equal to y")
25 | else:
26 | print("x is greater than y")
27 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/10_11def函数 参数.py:
--------------------------------------------------------------------------------
1 | # def函数
2 |
3 |
4 | a = 1
5 | b = 2
6 | c = a + b
7 | print(c)
8 |
9 | def function(a, b):
10 | c = a + b
11 | print('this c is ', c)
12 |
13 | function(1,2)
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/12函数默认参数.py:
--------------------------------------------------------------------------------
1 | def sale_car(price, color='red', brand='carmy', is_second_hand='True'):
2 | print('price:', price,
3 | 'colour', color,
4 | 'brand', brand,
5 | 'is_second', brand,
6 | )
7 |
8 | # sale_car(1000,'red','carmy', 'True')
9 | sale_car(1001212, 'brue')
10 |
11 | # 默认值后面必须是默认值
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/13全局局部变量globalLocal.py:
--------------------------------------------------------------------------------
1 | APPLE = 100
2 | a=None
3 |
4 | def fun():
5 | global a
6 | a = 10
7 | print(a) # 10
8 | return a+100
9 | print(a) # None
10 | print(fun()) #110
11 | print(a)
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/14模块安装.py:
--------------------------------------------------------------------------------
1 | # https://sourceforge.net/
2 |
3 | # pip3 install numpy-1.11.1
4 |
5 | # pip3 install -U numpy
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/15读写文件1.py:
--------------------------------------------------------------------------------
1 | text = "This is my first line.\nThis is my next line."
2 | # print(text)
3 |
4 | my_file = open('my file.txt', 'w')
5 | my_file.write(text)
6 | my_file.close()
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/15读写文件2.py:
--------------------------------------------------------------------------------
1 | # text = "This is my first line.\nThis is my next line."
2 | # print(text)
3 | append_text="\nThis is a appended file"
4 |
5 | my_file = open('my file.txt', 'a')
6 | my_file.write(append_text)
7 | my_file.close()
8 |
9 |
10 | # append文件
11 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/15读写文件3.py:
--------------------------------------------------------------------------------
1 | file = open('my file.txt','r')
2 |
3 |
4 | # content = file.readline() # list 逐行 This is my first line.
5 | allcontent = file.readlines()
6 | # ['This is my first line.\n', 'This is my next line.\n', 'This is a appended file\n', 'This is a appended file']
7 |
8 | print(allcontent)
9 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/18class类.py:
--------------------------------------------------------------------------------
1 | # class A开头大写
2 |
3 | class Calculator:
4 | name = "Good calculator"
5 | price= 10000
6 | def add(self, x, y): # 默认self
7 | print(self.name)
8 | result = x + y
9 | print(result)
10 | def minus(self, x, y):
11 | result = x + y
12 | print(result)
13 | def times(self, x, y):
14 | result = x * y
15 | print(result)
16 | def divide(self, x, y):
17 | print()
18 |
19 | # 调用
20 |
21 |
22 | cal = Calculator() # Good calculator
23 | print(cal.name)
24 | print(cal.price) # 为什么没有输出?????????噗,好智障
25 | cal.add(10, 11) # 21
26 |
27 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/19init类.py:
--------------------------------------------------------------------------------
1 | # class A开头大写
2 |
3 | class Calculator:
4 | name = "Good calculator"
5 | price = 10000
6 | def __init__(self, name, price, hight, width, weight):
7 | self.n = name
8 | self.p = price
9 | self.h = hight
10 | self.w = width
11 | self.w = weight
12 |
13 | def add(self, x, y): # 默认self
14 | print(self.name)
15 | result = x + y
16 | print(result)
17 | def minus(self, x, y):
18 | result = x + y
19 | print(result)
20 | def times(self, x, y):
21 | result = x * y
22 | print(result)
23 | def divide(self, x, y):
24 | print()
25 |
26 | # 调用
27 |
28 | cal = Calculator('Good', 1, 2, 3, 4)
29 | print(cal)
30 | print(cal.name)
31 |
32 |
33 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/20input输入.py:
--------------------------------------------------------------------------------
1 | a_input = input("Please give a number:")
2 |
3 | print("this number is ", a_input)
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/21元组列表.py:
--------------------------------------------------------------------------------
1 | # tuple list
2 |
3 | a_tuple = (1, 2, 3)
4 | another_tuple = 1,2,3
5 | a_list = [4, 5, 6]
6 |
7 | # for content in a_list:
8 | # print(content)
9 |
10 | for index in range(len(a_list)):
11 | print("index=",index,"number in list=", a_list[index])
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/22列表list.py:
--------------------------------------------------------------------------------
1 | # list
2 | a = [1, 2, 33, 4, 1, 56, 7, -1]
3 | # a.append(123) # append
4 | print(a)
5 |
6 | a.insert(1, 0) # 插入
7 | print(a)
8 |
9 | a.remove(33) # remove value 第一个值
10 | print(a)
11 |
12 | print(a[0])
13 | print(a[-1]) # 最后一位
14 |
15 | print(a[0:3])
16 | print(a[:3])
17 | print(a[3:])
18 |
19 | print(a[-3:])
20 |
21 | # 索引
22 | print(a.index(1))
23 | print(a.count(1)) # 出现几次
24 |
25 | # 排序
26 | a.sort(reverse=True)
27 |
28 | print(a)
29 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/23多维列表.py:
--------------------------------------------------------------------------------
1 | a = [1, 2, 3, 4, 5]
2 |
3 | multi_dim_a = [
4 | [1, 2, 3],
5 | [4, 5, 6],
6 | [7, 8, 9]
7 | ]
8 | print(a[1])
9 | print(multi_dim_a[0][2])
10 |
11 |
12 | # 切片转成np.array()处理
13 | import numpy as np
14 |
15 | # 对于ndarray的切片,格式为[x1:x2, y1:y2],截取行数为[x1,x2),列数为[y1,y2)。左边闭空间,右边开空间。
16 | # 如果要截取某一行,格式为[x,:],截取某一列:[:,y]
17 | # 其他截取以此类推
18 |
19 | list = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]
20 | list_ndarray = np.array(list)
21 | list_t = list_ndarray[1:3,1:3]
22 | print(list_t)
23 |
24 | # 输出如下
25 | # [[ 6 7]
26 | # [10 11]
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/24字典dictionary.py:
--------------------------------------------------------------------------------
1 | # 字典 {键值对} 无序 里面放什么都行
2 |
3 | a_list = {1, 2, 3, 4, 5}
4 | d = {'apple': [1,2,3], 'pear': 2, 'orange': {1:'111',2:'222'}}
5 |
6 | print(d)
7 |
8 | print(d['apple'])
9 | del d['apple']
10 |
11 | d['b'] = 20
12 |
13 | print(d)
14 | print(d['orange'][1]) # {1:'111',2:'222'}
15 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/25import模块.py:
--------------------------------------------------------------------------------
1 | # 四种形式
2 |
3 | # import time
4 |
5 | # import time as t
6 |
7 |
8 | # from time import time,localtime
9 |
10 | from time import *
11 |
12 |
13 | print(localtime())
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/26自己的模块.py:
--------------------------------------------------------------------------------
1 | import m1 # 凡在site-packages里面也可以
2 |
3 | m1.printdata(123)
4 |
5 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/27continue&break.py:
--------------------------------------------------------------------------------
1 | a = True
2 | while a:
3 | b = input('type something:')
4 | if b == '1':
5 | break # continue
6 | else:
7 | pass
8 | print('still in while')
9 |
10 | print('finish run')
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/28错误处理try.py:
--------------------------------------------------------------------------------
1 |
2 | try:
3 | file = open('eeeee', 'r+')
4 | except Exception as e:
5 | print("[Errno 2] No such file or directory: 'eeeee'")
6 | response = input('do you want to create a new file?')
7 | if response == 'y':
8 | file = open('eeeee', 'w')
9 | else:
10 | pass
11 | else:
12 | file.write('ssss')
13 |
14 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/29zip_lambda_map.py:
--------------------------------------------------------------------------------
1 |
2 | ''' zip
3 | lambda
4 | map '''
5 |
6 |
7 | a = [1, 2, 3]
8 | b = [4, 5, 6]
9 | print(zip(a, b)) #
10 |
11 | print(list(zip(a, b)))
12 |
13 | for i, j in zip(a, b):
14 | print(i / 2, j * 2)
15 |
16 | zip(a, a, b)
17 |
18 |
19 | # lambda
20 |
21 | def fun1(x, y):
22 | return (x + y)
23 |
24 | fun2 = lambda x, y: x + y
25 |
26 | print(fun2(2, 3))
27 |
28 | #map
29 |
30 | map(fun1, [1], [2])
31 | print(map(fun1, [1], [2]))
32 |
33 | list(map(fun1, [1], [2]))
34 | print(list(map(fun1, [1], [2])))
35 | print(list(map(fun1, [1,3], [2,1])))
36 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/30浅复制深复制(deepcopy).py:
--------------------------------------------------------------------------------
1 | import copy
2 |
3 | a = [1, 2, 3]
4 | b = a
5 |
6 | id(a) # 硬盘索引
7 | id(b)
8 |
9 | print('a:', id(a), '\nb:', id(b))
10 | print(id(a)==id(b))
11 | a[0] = 3
12 |
13 | print(b)
14 |
15 | c = copy.copy(a) # shallow copy
16 | print(id(c) == id(a))
17 |
18 | n = [1, 2, [3, 4]]
19 | m=copy.copy(n)
20 | print(id(m) == id(n))
21 | print(a[2]==b[2]) # 一样的
22 |
23 |
24 | # deep copy
25 |
26 | e = copy.deepcopy(n)
27 |
28 | print(e[2]==n[2])
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/31threading多线程.py:
--------------------------------------------------------------------------------
1 | # 见其他课程
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/32multiprocessing多核.py:
--------------------------------------------------------------------------------
1 | # 见其他课程
2 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/33tkinter.py:
--------------------------------------------------------------------------------
1 | # GUI 界面
2 |
3 | # 见其他课程
4 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/34pickle存放数据.py:
--------------------------------------------------------------------------------
1 | # pickle.dump(a_dict, file)
2 | # a_dict1 = pickle.load(file)
3 |
4 | import pickle
5 |
6 | a_dict = {'da': 111, '2': [1, 3, 5]}
7 |
8 | # file = open('pickle_example.pickle', 'wb') # wb二进制
9 |
10 | # pickle.dump(a_dict, file)
11 |
12 | # file.close
13 |
14 |
15 | # file = open('pickle_example.pickle', 'rb')
16 | # a_dict1 = pickle.load(file)
17 | # file.close()
18 | # print(a_dict1)
19 |
20 |
21 | # with简写,省去close()
22 |
23 | with open('pickle_example.pickle', 'rb') as file:
24 | a_dict1 = pickle.load(file)
25 | print(a_dict1)
26 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/35set找不同.py:
--------------------------------------------------------------------------------
1 | char_list = ['a', 'b', 'b', 'c', 'c', 'c']
2 |
3 | print(set(char_list))
4 | print(type(set(char_list)))
5 |
6 |
7 |
8 | sentence = 'Welcome Back to This Tutorial'
9 |
10 | print(set(sentence))
11 |
12 | unique_char = set(char_list)
13 | unique_char.add('x') # add
14 | print(unique_char)
15 |
16 |
17 | # unique_char.clear() # 清除
18 |
19 | # unique_char.remove('x') # 移除
20 |
21 | # set交集
22 | set1 = unique_char
23 | set2 = {'a', 'b'}
24 |
25 | print(set1.difference(set2))
26 | print(set1.intersection(set2))# 交集
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/36RegEx正则表达式.py:
--------------------------------------------------------------------------------
1 | #主要是爬虫
2 |
3 | import re # 正则表达式
4 | pattern1 = 'cat'
5 | pattern2 = 'bird'
6 | string = 'dog runs to cat'
7 |
8 |
9 | print(re.search(pattern1, string))
10 |
11 | print(re.search(pattern2, string))
12 |
13 |
14 | # 匹配多种可能 ,使用[]
15 | # r[au]n ran,run
16 |
17 |
18 | # 更多种
19 |
20 | # [0 - 9]
21 | # [a - z]
22 | # [0-9a-z]
23 |
24 | # 特征数字匹配
25 |
26 | # 见下图
27 |
28 | # 
29 |
30 |
31 |
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/__pycache__/m1.cpython-35.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/HuangCongQing/Python/1deff8f55b7d1849a8b8d064a09b512435302cb3/python3_tutorials_莫凡/__pycache__/m1.cpython-35.pyc
--------------------------------------------------------------------------------
/python3_tutorials_莫凡/m1.py:
--------------------------------------------------------------------------------
1 | def printdata(data):
2 | print('I am m1')
3 | print(data)
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/01python0.py:
--------------------------------------------------------------------------------
1 | # -*- coding: UTF-8 -*-
2 | '''
3 | Created on 2017年8月12日
4 |
5 | @author: Chongqing
6 | '''
7 | # 在 python 中,strings, tuples, 和 numbers 是不可更改的对象,而 list,dict 等则是可以修改的对象。
8 |
9 | # 默认情况下,Python 3 源码文件以 UTF-8 编码
10 | print("Hello Python35 Chongqing 重庆")
11 | import os
12 | import requests # import 的 Package
13 |
14 | list=[1, 2, 3, "重庆"]
15 | print('list_' + str(list))
16 |
17 | print (os.getcwd())
18 | r = requests.get('http://www.baidu.com')
19 | print(r.url)
20 | print(r.encoding)
21 | # print(r.text)
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/02基本数据类型.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # coding=gbk
3 | '''
4 | Created on 2017年8月12日
5 |
6 | @author: Chongqing
7 | '''
8 | # Python3 中有六个标准的数据类型:
9 | # Number(数字)
10 | # String(字符串) 不可更改
11 | # List(列表) 可更改
12 | # Tuple(元组) 不可更改
13 | # Sets(集合)
14 | # Dictionary(字典)可更改
15 |
16 |
17 | # 不可变数据(3 个):Number(数字)、String(字符串)、Tuple(元组);
18 | # 可变数据(3 个):List(列表)、Set(集合)、Dictionary(字典)。
19 |
20 | # 多个变量赋值
21 | a, b, c=1,2,"Chognqing"
22 | print(a,b,c)
23 |
24 | # 1,数字 ---int float 布尔值(False, True) 复数J
25 | d,e,f,g = 10, 1.5,True, 4+3j
26 | print(d,e,f,g)
27 |
28 | ## type(),查询变量所指的对象类型, isinstance
29 | print(type(d),type(e),type(f),type(g))
30 | print(isinstance(a, int))
31 |
32 | # del语句删除一些对象。
33 | # del var_a, var_b
34 |
35 | # 数值运算
36 | print(2 / 4) # 除法,得到一个浮点数
37 | print( 2 // 4) # 除法,得到一个整数
38 | print(2 ** 5) # 乘方
39 |
40 | # 字符串 String,单引号,双引号,反斜杠转义字符
41 | # 0 为开始值,-1 为从末尾的开始位置。
42 | # Python中的字符串不能改变。
43 |
44 | str = "Huang"
45 | print(str[0:-2]) # 输出str[0]--str[-3],,,不输出str[-2]
46 | print(str*2) # 复制2次
47 | print(str+" Chong")# 连接字符串
48 |
49 | # 不想让反斜杠发生转义,可以在字符串前面添加一个 r,表示原始字符串。。反斜杠(\)可以作为续行符
50 | print('Huang\Chong') # ??????????????????????没有转义
51 | print(r'Huang\Chong')
52 | # Python中的字符串不能改变。
53 |
54 | # 列表List 变量[头下标:尾下标] ------------数组--------------------------------------------------------
55 | # ython字符串不一样的是,列表中的元素是可以改变的:
56 | #List内置了有很多方法,例如append()、pop()等
57 | list = ['Haung',12, 2.34]
58 | print("list[1:]", list[1:])
59 | list[1:] = [] # 可重置
60 | print(list[1:])
61 |
62 |
63 | # Tuple(元组)
64 | # 虽然tuple的元素不可改变,但它可以包含可变的对象
65 | tup = (1,"HAung")
66 | # tup[0]=1 # 修改元组元素的操作是非法的
67 |
68 | # 构造包含 0 个或 1 个元素的元组比较特殊,所以有一些额外的语法规则:
69 | tup1 = () # 空元组
70 | tup2 = (20,) # 一个元素,需要在元素后添加逗号
71 |
72 |
73 | # Set(集合) 顺序真的好好随意
74 | # 集合(set)是一个无序不重复元素的序列
75 | # 成员关系测试和删除重复元素
76 | # 用大括号 { } 或者 set() 函数创建集合,注意:创建一个空集合必须用 set() 而不是 { },因为 { } 是用来创建一个空字典。
77 | student = {'Tom', 'Jim2', 'Mary3', 'Tom', 'Jack5', 'Rose6'}
78 | print(student) # 输出集合,重复的元素被自动去掉
79 | # 成员测试
80 | if('Rose6' in student) :
81 | print('Rose 在集合中')
82 | else :
83 | print('Rose 不在集合中')
84 |
85 |
86 | # set可以进行集合运算
87 | a = set('abracadabra')
88 | b = set('alacazam')
89 |
90 | print(a)
91 | print(b)
92 |
93 | print(a - b) # a和b的差集
94 |
95 | print(a | b) # a和b的并集
96 |
97 | print(a & b) # a和b的交集
98 |
99 | print(a ^ b) # a和b中不同时存在的元素
100 |
101 |
102 | # Dictionary(字典)
103 | # 列表是有序的对象结合,字典是无序的对象集合。
104 | # 字典用"{ }"标识,它是一个无序的键(key) : 值(value)对集合。
105 | dict ={}
106 | dict['name']='Huang'
107 | dict[1]=123
108 |
109 | tinydict={'name': 'Chongqing', 'ages': 20}
110 |
111 | print(dict["name"])
112 | print(tinydict.keys())
113 | print(tinydict.values())
114 |
115 | # 构造函数 dict() 可以直接从键值对序列中构建字典如下:
116 | print({x: x**2 for x in (2, 4, 6)})
117 |
118 | # Python数据类型转换
119 | s='ChongQIng'
120 | # 将序列 s 转换为一个元组
121 |
122 | print(tuple(s))
123 | print(dict(tup)) # 创建一个字典。str 必须是一个序列 (key,value)元组。
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/03函数.py:
--------------------------------------------------------------------------------
1 | '''
2 | Created on 2017年8月12日
3 |
4 | @author: Chongqing
5 | '''
6 | # def 函数名(参数列表):
7 | # 函数体
8 |
9 | # 函数调用
10 | #定义函数
11 | def printme(str):
12 | "打印任意字符串:"
13 | print(str);
14 | return;
15 | # 调用函数
16 |
17 | print(printme("我要调用函数"))
18 |
19 |
20 | # 参数传递
21 | # 在 python 中,类型属于对象,变量是没有类型的:
22 |
23 | # 可更改(mutable)与不可更改(immutable)对象
24 |
25 | # 传不可变对象实例
26 | def ChangeInt( a ):
27 | a = 10
28 |
29 | b = 2
30 | ChangeInt(b)
31 | print( b ) # 结果是 2
32 | # 传可变对象实例
33 | # 可写函数说明
34 | def changeme( mylist ):
35 | "修改传入的列表"
36 | mylist.append([1,2,3,4]);
37 | print ("函数内取值: ", mylist)
38 | # 不带参数值的return语句返回None
39 | return
40 |
41 | # 调用changeme函数
42 | mylist = [10,20,30];
43 | changeme( mylist );
44 | print ("函数外取值: ", mylist)
45 |
46 |
47 | # 匿名函数 lambda [arg1 [,arg2,.....argn]]:expression
48 | # ambda的主体是一个表达式,而不是一个代码块
49 | sum = lambda arg1, arg2: arg1+arg2;
50 | print("匿名函数相加后的值:",sum(20,30))
51 |
52 | # 变量作用域
53 |
54 | x = int(2.9) # 内建作用域
55 |
56 | g_count = 0 # 全局作用域
57 | def outer():
58 | o_count = 1 # 闭包函数外的函数中
59 | def inner():
60 | i_count = 2 # 局部作用域
61 |
62 | #Python 中只有模块(module),类(class)以及函数(def、lambda)才会引入新的作用域,
63 | # 其它的代码块(如 if/elif/else/、try/except、for/while等)是不会引入新的作用域的
64 |
65 |
66 | # global 和 nonlocal关键字
67 |
68 | # 当内部作用域想修改外部作用域的变量时,就要用到global和nonlocal关键字了。
69 | # global修改全局变量
70 | num = 1
71 | def fun1():
72 | global num # 需要使用 global 关键字声明
73 | print(num)
74 | num = 123
75 | print("global关键字声明:",num)
76 | fun1()
77 | # 修改嵌套作用域(enclosing 作用域,外层非全局作用域)中的变量则需要 nonlocal 关键字
78 | def outer1():
79 | num = 10
80 | def inner():
81 | nonlocal num # nonlocal关键字声明
82 | num = 100
83 | print(num)
84 | inner()
85 | print("nonlocal:",num)
86 | outer1()
87 |
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/04控制流.py:
--------------------------------------------------------------------------------
1 | # coding=gbk
2 | '''
3 | Created on 2017年8月14日
4 |
5 | @author: 黄重庆
6 | '''
7 | # if&for
8 | # while && range
9 | # break && contine && pass
10 |
11 | # if语句
12 | # Python 中用 elif 代替了 else if
13 | # 在Python中没有switch – case语句
14 |
15 | # 以下实例 x 为 0-99 取一个数,y 为 0-199 取一个数,如果 x>y 则输出 x, 如果 x 等于 y 则输出 x+y,否则输出y。
16 | import random
17 |
18 | x = random.choice(range(100))
19 | y = random.choice(range(100))
20 |
21 | if x>y:
22 | print("x:",x)
23 | elif x==y:
24 | print("x+y:",x+y)
25 | else:
26 | print("y:",y)
27 |
28 | # for循环
29 | # for可以遍历任何序列的项目,如一个列表或者一个字符串
30 | print("for循环----------------------------------")
31 | sites = ["Baidu", "Google","Runoob","Taobao"]
32 | for site in sites:
33 | if site == "Runoob":
34 | print("菜鸟教程!")
35 | break
36 | print("循环数据 " + site)
37 | else:
38 | print("没有循环数据!")
39 | print("完成循环!")
40 |
41 |
42 |
43 |
44 | # while语句
45 |
46 | # 在Python中没有do..while循环。
47 | # 可以使用 CTRL+C 来退出当前的无限循环。
48 |
49 | # while 循环使用 else 语句
50 | count = 0
51 | while count < 5:
52 | print (count, " 小于 5")
53 | count = count + 1
54 | else:
55 | print (count, " 大于或等于 5")
56 |
57 |
58 | ## range()
59 | #需要遍历数字序列,可以使用内置range()函数。它会生成数列
60 | print("range()-----------------------------------")
61 | for i in range(5):
62 | print(i)
63 |
64 | # 也可以使range以指定数字开始并指定不同的增量
65 | for i in range(0, 10, 3) :
66 | print(i)
67 |
68 | # 可以结合range()和len()函数以遍历一个序列的索引
69 |
70 | a = ['Google', 'Baidu', 'Runoob', 'Taobao', 'QQ']
71 | for i in range(len(a)):
72 | print(i, a[i])
73 |
74 | # 使用range()函数来创建一个列表:
75 |
76 | m=list(range(5))
77 | print(m)
78 |
79 | # 求和
80 | sum = sum(range(101))
81 | print("求和1-100:",sum)
82 |
83 | # break和continue语句及循环中的else子句
84 |
85 |
86 | # pass 语句
87 | # Python pass是空语句,是为了保持程序结构的完整性。
88 | # pass 不做任何事情,一般用做占位语句
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/图形界面介绍GuiTkinter和猜数字游戏.py:
--------------------------------------------------------------------------------
1 | # -*- coding: UTF-8 -*-
2 | '''
3 | Created on 2017年8月15日
4 |
5 | @author: hasee
6 | '''
7 | from tkinter import *
8 |
9 | import tkinter.simpledialog as dl
10 | import tkinter.messagebox as mb
11 |
12 | #设置GUI
13 | root = Tk()
14 | w = Label(root, text = "Label Title")
15 | w.pack()
16 |
17 | # 欢迎信息
18 | # mb.showinfo("title,这是标题", "message")
19 | # guess =dl.askinteger("title", "Enter a number")
20 | #
21 | # output = "This is a output message "
22 | # mb.showinfo("OutPut: ",output)
23 |
24 |
25 | # #欢迎消息
26 | mb.showinfo("Welcome", "Welcome to Guess Number Game")
27 | #
28 | #
29 | # #处理信息
30 | number = 59
31 | #
32 | while True:
33 | #让用户输入信息
34 | guess = dl.askinteger("Number", "What's your guess?")
35 |
36 | if guess == number:
37 | # New block starts here
38 | output = 'Bingo! you guessed it right, but you do not win any prizes!'
39 | mb.showinfo("Hint: ", output)
40 | break
41 | # New block ends here
42 | elif guess < number:
43 | output = 'No, the number is a higer than that'
44 | mb.showinfo("Hint: ", output)
45 | else:
46 | output = 'No, the number is a lower than that'
47 | mb.showinfo("Hint: ", output)
48 |
49 | print('Done')
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/装饰器Decorators.py:
--------------------------------------------------------------------------------
1 | # coding=gbk
2 | '''
3 | Created on 2017年8月14日
4 |
5 | @author: 黄重庆
6 | '''
7 | # if&for
8 | # while && range
9 | # break && contine && pass
10 |
11 | # if语句
12 | # Python 中用 elif 代替了 else if
13 | # 在Python中没有switch – case语句
14 |
15 | # 以下实例 x 为 0-99 取一个数,y 为 0-199 取一个数,如果 x>y 则输出 x, 如果 x 等于 y 则输出 x+y,否则输出y。
16 | import random
17 |
18 | x = random.choice(range(100))
19 | y = random.choice(range(100))
20 |
21 | if x>y:
22 | print("x:",x)
23 | elif x==y:
24 | print("x+y:",x+y)
25 | else:
26 | print("y:",y)
27 |
28 | # for循环
29 | # for可以遍历任何序列的项目,如一个列表或者一个字符串
30 | print("for循环----------------------------------")
31 | sites = ["Baidu", "Google","Runoob","Taobao"]
32 | for site in sites:
33 | if site == "Runoob":
34 | print("菜鸟教程!")
35 | break
36 | print("循环数据 " + site)
37 | else:
38 | print("没有循环数据!")
39 | print("完成循环!")
40 |
41 |
42 |
43 |
44 | # while语句
45 |
46 | # 在Python中没有do..while循环。
47 | # 可以使用 CTRL+C 来退出当前的无限循环。
48 |
49 | # while 循环使用 else 语句
50 | count = 0
51 | while count < 5:
52 | print (count, " 小于 5")
53 | count = count + 1
54 | else:
55 | print (count, " 大于或等于 5")
56 |
57 |
58 | ## range()
59 | #需要遍历数字序列,可以使用内置range()函数。它会生成数列
60 | print("range()-----------------------------------")
61 | for i in range(5):
62 | print(i)
63 |
64 | # 也可以使range以指定数字开始并指定不同的增量
65 | for i in range(0, 10, 3) :
66 | print(i)
67 |
68 | # 可以结合range()和len()函数以遍历一个序列的索引
69 |
70 | a = ['Google', 'Baidu', 'Runoob', 'Taobao', 'QQ']
71 | for i in range(len(a)):
72 | print(i, a[i])
73 |
74 | # 使用range()函数来创建一个列表:
75 |
76 | m=list(range(5))
77 | print(m)
78 |
79 | # 求和
80 | sum = sum(range(101))
81 | print("求和1-100:",sum)
82 |
83 | # break和continue语句及循环中的else子句
84 |
85 |
86 | # pass 语句
87 | # Python pass是空语句,是为了保持程序结构的完整性。
88 | # pass 不做任何事情,一般用做占位语句
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/输入输出方式.py:
--------------------------------------------------------------------------------
1 | # coding=gbk
2 | '''
3 | Created on 2017年8月14日
4 |
5 | @author: 黄重庆
6 | '''
7 |
8 | # 接收用户的输入: input()
9 | # 输入格式:str(), str.format()
10 |
11 | # 读写文件
12 | # f.read()
13 | # f.readline()
14 |
15 | # str_1 = input("Enter a string:")
16 | # str_2 = input("Enter another a string:")
17 |
18 |
19 | ## Output
20 | # print("str_1 is :" + str_1 + ", str_2 is :" + str_2)
21 | # print("str_1 is {} + str_2 is {}".format(str_1, str_2))
22 |
23 |
24 | ## 读写文件
25 | # 打开一个文件
26 | # f = open("File-test.txt", "w")
27 | f = open("File-test.txt", "r")
28 |
29 | # f.write( "Python 是一个非常好的语言。\n是的,的确非常好!!\n" )
30 | str0 = f.read()
31 | print(str0)
32 | str1 = f.tell()
33 | print("字节数:", str1)
34 |
35 | # 关闭打开的文件
36 | f.close()
37 |
38 |
39 | # python文件写入也可以进行网站爬虫,我的python版本是3.6,以下代码是打开project.txt文件,
40 | # 并向里面写入http://www.baidu.com网站代码。
41 | from urllib import request
42 |
43 | response1 = request.urlopen("http://www.baidu.com/") # 打开网站
44 | fi = open("project.txt", 'w') # open一个txt文件
45 | page = fi.write(str(response1.read())) # 网站代码写入
46 | fi.close() # 关闭txt文件
47 |
48 |
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/错误与异常.py:
--------------------------------------------------------------------------------
1 | # coding=gbk
2 | '''
3 | Created on 2017年8月14日
4 |
5 | @author: hasee
6 | '''
7 | # 语法错误 syntax errors&& 异常Exceptions
8 |
9 | # while True print("语法错误")
10 | # print(8/0)
11 |
12 |
13 |
14 |
15 | # while True:
16 | # try:
17 | # x = int(input("Please enter a number: "))
18 | # break
19 | # except ValueError:
20 | # print("Oops! That was no valid number. Try again ")
21 |
22 |
23 | # 一个except子句可以同时处理多个异常,这些异常将被放在一个括号里成为一个元组
24 | # except (RuntimeError, TypeError, NameError):
25 | # pass
26 |
27 |
28 | # import sys
29 | #
30 | # try:
31 | # f = open('myfile.txt')
32 | # s = f.readline()
33 | # i = int(s.strip())
34 | # except OSError as err:
35 | # print("OS error: {0}".format(err))
36 | # except ValueError:
37 | # print("Could not convert data to an integer.")
38 | # except:
39 | # print("Unexpected error:", sys.exc_info()[0])
40 | # raise
41 |
42 | # 抛出指定异常
43 | # Python 使用 raise 语句抛出一个指定的异常。
44 |
45 | # raise NameError('HiThere')
46 |
47 |
48 | # 定义清理行为
49 | # try 语句还有另外一个可选的子句,它定义了无论在任何情况下都会执行的清理行为
50 | # try:
51 | # raise KeyboardInterrupt
52 | # finally:
53 | # print('Goodbye, world!')
54 | #
55 |
56 | # 预定义的清理行为
57 |
58 | for line in open("File-test.txt"):
59 | print(line, end="")
60 |
61 | # 关键词 with 语句就可以保证诸如文件之类的对象在使用完之后一定会正确的执行他的清理方法:
62 | with open("File-test.txt") as f:
63 | for line in f:
64 | print(line, end="")
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/python3_tutorials_菜鸟教程/面向对象编程(ObjectOriented.py:
--------------------------------------------------------------------------------
1 | #!/usr/local/bin/python2.7
2 | # encoding: utf-8
3 | '''
4 | 面向对象编程ObjectOriented -- shortdesc
5 |
6 | 面向对象编程ObjectOriented is a description
7 |
8 | It defines classes_and_methods
9 |
10 | @author: 黄重庆
11 |
12 | @copyright: 2017 organization_name. All rights reserved.
13 |
14 | @license: license
15 |
16 | @contact: 1756260160@qq.com
17 | @deffield updated: Updated
18 | '''
19 | # 此类可能会定义一个名为 __init__() 的特殊方法(构造方法)
20 | # 类的私有属性和方法
21 | # __private_attrs:_private_method 两个下划线开头,声明该属性//////方法为私有,不能在类地外部被使用或直接访问
22 |
23 | class Complex:
24 | def __init__(self, realpart, imagpart):
25 | self.r = realpart
26 | self.i = imagpart
27 | """self代表类的实例,而非类"""
28 | x = Complex(3.0, -4.5)
29 | print(x.r, x.i) # 输出结果:3.0 -4.5
30 |
31 | # 类的方法
32 | #类定义
33 | class people1:
34 | #定义基本属性
35 | name = ''
36 | age = 0
37 | #定义私有属性,私有属性在类外部无法直接进行访问
38 | __weight = 0
39 | #定义构造方法
40 | def __init__(self,n,a,w):
41 | self.name = n
42 | self.age = a
43 | self.__weight = w
44 | def speak(self):
45 | print("%s 说: 我 %d 岁。" %(self.name,self.age))
46 |
47 | # 实例化类
48 | p = people1('重庆',21,68)
49 | p.speak()
50 |
51 |
52 | # 继承
53 |
54 | #类定义
55 | class people2:
56 | #定义基本属性
57 | name = ''
58 | age = 0
59 | #定义私有属性,私有属性在类外部无法直接进行访问
60 | __weight = 0
61 | #定义构造方法
62 | def __init__(self,n,a,w):
63 | self.name = n
64 | self.age = a
65 | self.__weight = w
66 | def speak(self):
67 | print("%s 说: 我 %d 岁。" %(self.name,self.age))
68 |
69 | #单继承示例
70 | class student(people2):
71 | grade = ''
72 | def __init__(self,n,a,w,g):
73 | #调用父类的构函
74 | people2.__init__(self,n,a,w)
75 | self.grade = g
76 | #覆写父类的方法
77 | def speak(self):
78 | print("%s 说: 我 %d 岁了,我在读 %d 年级"%(self.name,self.age,self.grade))
79 |
80 |
81 |
82 | s = student('ken',10,60,3)
83 | s.speak()
84 |
85 | # 多继承
86 |
87 | #类定义
88 | class people3:
89 | #定义基本属性
90 | name = ''
91 | age = 0
92 | #定义私有属性,私有属性在类外部无法直接进行访问
93 | __weight = 0
94 | #定义构造方法
95 | def __init__(self,n,a,w):
96 | self.name = n
97 | self.age = a
98 | self.__weight = w
99 | def speak(self):
100 | print("%s 说: 我 %d 岁。" %(self.name,self.age))
101 |
102 | #单继承示例
103 | class student3(people3):
104 | grade = ''
105 | def __init__(self,n,a,w,g):
106 | #调用父类的构函
107 | people3.__init__(self,n,a,w)
108 | self.grade = g
109 | #覆写父类的方法
110 | def speak(self):
111 | print("%s 说: 我 %d 岁了,我在读 %d 年级"%(self.name,self.age,self.grade))
112 |
113 | #另一个类,多重继承之前的准备
114 | class speaker():
115 | topic = ''
116 | name = ''
117 | def __init__(self,n,t):
118 | self.name = n
119 | self.topic = t
120 | def speak(self):
121 | print("我叫 %s,我是一个演说家,我演讲的主题是 %s"%(self.name,self.topic))
122 |
123 | #多重继承
124 | class sample(speaker,student3):
125 | a =''
126 | def __init__(self,n,a,w,g,t):
127 | student3.__init__(self,n,a,w,g)
128 | speaker.__init__(self,n,t)
129 |
130 | test = sample("重庆",25,80,4,"Python")
131 | test.speak() #方法名同,默认调用的是在括号中排前地父类的方法
132 |
133 |
134 |
135 |
136 |
137 | # 方法重写
138 |
139 | class Parent: # 定义父类
140 | def myMethod(self):
141 | print ('调用父类方法')
142 |
143 | class Child(Parent): # 定义子类
144 | def myMethod(self):
145 | print ('调用子类方法')
146 |
147 | c = Child() # 子类实例
148 | c.myMethod() # 子类调用重写方法
149 |
150 |
151 | # 类的私有属性和方法
152 | class JustCounter:
153 | __secretCount = 0 # 私有变量
154 | publicCount = 0 # 公开变量
155 |
156 | def count(self):
157 | self.__secretCount += 1
158 | self.publicCount += 1
159 | print (self.__secretCount)
160 |
161 | counter = JustCounter()
162 | counter.count()
163 | counter.count()
164 | print (counter.publicCount)
165 | print (counter.__secretCount) # 报错,实例不能访问私有变量
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
--------------------------------------------------------------------------------
/test.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description: test
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2020-11-17 13:50:28
7 | LastEditTime: 2022-04-25 14:52:36
8 | FilePath: /Python/test.py
9 | '''
10 | import socket
11 |
12 | print(socket.gethostname()) # hcq-G5-5590
13 |
14 | import numpy as np
15 |
16 | a = np.arange(12).reshape(1,3,4)
17 | print(a)
18 | # print(a>4)
19 | # print(a[a>4])
20 | print(a[:, :, 3]>8)
21 | print(a[a[:, :, 3]>8])
22 |
23 |
24 | import random
25 | arr = ["2022-12", "2022-33", '3023-12', '2343-24']
26 | print("before: ", arr)
27 | random.shuffle(arr)
28 | print("after: ", arr)
--------------------------------------------------------------------------------
/tips.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 14,
6 | "metadata": {},
7 | "outputs": [
8 | {
9 | "name": "stdout",
10 | "output_type": "stream",
11 | "text": [
12 | "[1, 2, 3]\n",
13 | "1 2 3\n",
14 | "15\n"
15 | ]
16 | }
17 | ],
18 | "source": [
19 | "# https://blog.csdn.net/weixin_42360285/article/details/114420332\n",
20 | "# 单星号 * 用于对列表LIST或元组tuple中的元素进行取出(unpacke)。\n",
21 | "a = [1,2,3]\n",
22 | "print(a)\n",
23 | "print(*a)\n",
24 | "#print(**a)\n",
25 | "\n",
26 | "#双星号 **\n",
27 | "#双星号 ** 可将字典里的“值”取出\n",
28 | "# 字典前面加两个星号,是将字典解开成为独立的元素作为形参。 https://zhuanlan.zhihu.com/p/499740724\n",
29 | "def add(a, b):\n",
30 | " return a + b\n",
31 | "data = {'a':7, 'b':8}\n",
32 | "print(add(**data)) # 15"
33 | ]
34 | },
35 | {
36 | "cell_type": "markdown",
37 | "metadata": {},
38 | "source": [
39 | "## 输出其他类型可以转成str输出\n"
40 | ]
41 | },
42 | {
43 | "cell_type": "code",
44 | "execution_count": 1,
45 | "metadata": {},
46 | "outputs": [
47 | {
48 | "name": "stdout",
49 | "output_type": "stream",
50 | "text": [
51 | "gt_boxes.shape=(3, 4)\n"
52 | ]
53 | }
54 | ],
55 | "source": [
56 | "import numpy as np\n",
57 | "gt_boxes = np.arange(12).reshape(3,4)\n",
58 | "print('gt_boxes.shape=%s' % str(gt_boxes.shape))"
59 | ]
60 | },
61 | {
62 | "cell_type": "markdown",
63 | "metadata": {},
64 | "source": [
65 | "## 科学记数法字符串转换e-5消失问题: dtype='\n",
21 | "stu1.name = Zhangsan\n",
22 | "stu1.age = 18\n",
23 | "Zhangsan\n",
24 | "18\n"
25 | ]
26 | }
27 | ],
28 | "source": [
29 | "# 类的创建 \n",
30 | "class Student(object):\n",
31 | " count = 0 # 类属性\n",
32 | "\n",
33 | " def __init__(self, name, age): # __init__为类的构造函数\n",
34 | " self.name = name # 实例属性\n",
35 | " self.age = age # 实例属性\n",
36 | "\n",
37 | " def output(self): # 实例方法\n",
38 | " print(self.name)\n",
39 | " print(self.age)\n",
40 | "\n",
41 | "\n",
42 | "if __name__ == '__main__':\n",
43 | " stu1 = Student('Zhangsan', 18) # 使用Student类对象stu1\n",
44 | " print(stu1)\n",
45 | " print(\"stu1.name = %s\" % (stu1.name,)) # 利用对象stu1获取对象属性name。输出stu1.name = Zhangsan\n",
46 | " print(\"stu1.age = %d\" % (stu1.age,)) # 利用对象stu1获取对象属性age。输出stu1.age = 18\n",
47 | " stu1.output() # 利用对象stu1调用output方法。"
48 | ]
49 | },
50 | {
51 | "cell_type": "code",
52 | "execution_count": null,
53 | "metadata": {},
54 | "outputs": [],
55 | "source": []
56 | }
57 | ],
58 | "metadata": {
59 | "kernelspec": {
60 | "display_name": "Python 3.8.13 ('pcdet')",
61 | "language": "python",
62 | "name": "python3"
63 | },
64 | "language_info": {
65 | "codemirror_mode": {
66 | "name": "ipython",
67 | "version": 3
68 | },
69 | "file_extension": ".py",
70 | "mimetype": "text/x-python",
71 | "name": "python",
72 | "nbconvert_exporter": "python",
73 | "pygments_lexer": "ipython3",
74 | "version": "3.8.13"
75 | },
76 | "orig_nbformat": 4,
77 | "vscode": {
78 | "interpreter": {
79 | "hash": "4a4bb52955cb4b7ba3167560f52fbe8257746766a280283c0daccbe36f0c9125"
80 | }
81 | }
82 | },
83 | "nbformat": 4,
84 | "nbformat_minor": 2
85 | }
86 |
--------------------------------------------------------------------------------
/类和对象/02_init.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "## __init__继承"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "### 继承dict,super,直接返回类的实例"
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": 8,
20 | "metadata": {},
21 | "outputs": [],
22 | "source": [
23 | "# 类的创建(继承字典dict)\n",
24 | "class Student(dict):\n",
25 | " count = 0 # 类属性\n",
26 | "\n",
27 | " def __init__(self, name, age): # __init__为类的构造函数\n",
28 | " self.name = name # 实例属性\n",
29 | " self.age = age # 实例属性\n",
30 | " super().__init__({ # 继承dict的__init__的属性\n",
31 | " \"name\": name,\n",
32 | " \"age\": age,\n",
33 | " })\n",
34 | "\n",
35 | "\n",
36 | "if __name__ == '__main__':\n",
37 | " stu1 = Student('Zhangsan', 18) # 使用Student类对象stu1 直接返回类的实例\n",
38 | " print(stu1) # 继承dict,super,直接返回类的实例\n",
39 | "'''\n",
40 | "{'name': 'Zhangsan', 'age': 18} # dict\n",
41 | "'''"
42 | ]
43 | },
44 | {
45 | "cell_type": "code",
46 | "execution_count": null,
47 | "metadata": {},
48 | "outputs": [],
49 | "source": []
50 | }
51 | ],
52 | "metadata": {
53 | "kernelspec": {
54 | "display_name": "Python 3.8.13 ('pcdet')",
55 | "language": "python",
56 | "name": "python3"
57 | },
58 | "language_info": {
59 | "codemirror_mode": {
60 | "name": "ipython",
61 | "version": 3
62 | },
63 | "file_extension": ".py",
64 | "mimetype": "text/x-python",
65 | "name": "python",
66 | "nbconvert_exporter": "python",
67 | "pygments_lexer": "ipython3",
68 | "version": "3.8.13"
69 | },
70 | "orig_nbformat": 4,
71 | "vscode": {
72 | "interpreter": {
73 | "hash": "4a4bb52955cb4b7ba3167560f52fbe8257746766a280283c0daccbe36f0c9125"
74 | }
75 | }
76 | },
77 | "nbformat": 4,
78 | "nbformat_minor": 2
79 | }
80 |
--------------------------------------------------------------------------------
/类和对象/class.py:
--------------------------------------------------------------------------------
1 | '''
2 | Description:
3 | Author: HCQ
4 | Company(School): UCAS
5 | Email: 1756260160@qq.com
6 | Date: 2022-08-06 23:49:37
7 | LastEditTime: 2023-02-24 16:24:01
8 | FilePath: /Python/类和对象/class.py
9 | '''
10 |
11 | # 类的创建
12 | class Student(object):
13 | count = 0 # 类属性
14 |
15 | def __init__(self, name, age): # __init__为类的构造函数
16 | self.name = name # 实例属性
17 | self.age = age # 实例属性
18 |
19 | def output(self): # 实例方法
20 | print(self.name)
21 | print(self.age)
22 |
23 |
24 | if __name__ == '__main__':
25 | stu1 = Student('Zhangsan', 18) # 使用Student类对象stu1
26 | print("stu1.name = %s" % (stu1.name,)) # 利用对象stu1获取对象属性name。输出stu1.name = Zhangsan
27 | print("stu1.age = %d" % (stu1.age,)) # 利用对象stu1获取对象属性age。输出stu1.age = 18
28 | stu1.output() # 利用对象stu1调用output方法。
--------------------------------------------------------------------------------