![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
程序员正茂
喜欢干点有难度的事
展开
-
Google Colab训练yolov3自定义数据集
共分7步:一、进入Google Colab训练环境二、下载编译Darknet三、上传数据集四、修改配置文件五、下载预训练权重文件六、开始训练数据七、测试训练结果。原创 2022-11-28 17:33:35 · 1198 阅读 · 0 评论 -
pyinstaller error loading python dll python37.dll
pyinstaller error loading python dll python37.dll解决方法:点击dist文件夹中的exe运行,不要点击build文件下的exe。原创 2022-01-21 09:52:40 · 2893 阅读 · 0 评论 -
opencv-python使用cvui编写界面
安装cvuipip install cvui说明文档中用到指针的地方,使用列表代替(如low_threshold = [5]),取值时为low_threshold[0]import cv2import numpy as npimport cvuiWINDOW_NAME = 'CVUI Test'cvui.init(WINDOW_NAME)low_threshold = [5]method = cv2.THRESH_BINARYcap = cv2.VideoCap...原创 2022-01-19 18:11:55 · 4247 阅读 · 0 评论 -
PyInstaller Pre-Compiled Bootloader Not Found and Build Fails
解决方法有两种1.使用低版本pyinstallersudo pip3 install pyinstaller==4.5 -i https://pypi.tuna.tsinghua.edu.cn/simple some-package2.编译Bootloadergit clone https://github.com/pyinstaller/pyinstallercd pyinstaller/bootloaderpython3 ./waf distclean all...原创 2022-01-13 16:15:14 · 393 阅读 · 0 评论 -
百度EasyDL物体检测在安卓上测试
EasyDL:EasyDL定制化模型1.创建模型。2.创建数据集,上传图片。3.标注图片 。4.训练数据5.发布模型6.APP部署测试7.APP上测试原创 2021-12-24 17:59:41 · 1937 阅读 · 0 评论 -
安装Python IDE开发环境Spyder
1.下载安装Python,选择自定义安装,选中Add Python 3.7 to PATH。只勾选pip和py launcher就可以了选择自定义路径2.下载安装Spyder3.在Spyder中配置Python路径在Spyder中点击【Tools】【Perferences】,在【Python Interpreter】中选择Python路径4.在cmd中运行pip install opencv-python,就可以安装第三方包了。如果不能安装,可能是环境变量中没...原创 2021-12-23 11:52:15 · 2910 阅读 · 0 评论 -
Python树莓派TCP客户端
import os,sys,timeimport socketimport threading#接收来自服务端的消息def recv(): global client global ip global connect while True: try: byData = client.recv(30) except Exception as e: print("recei.原创 2021-06-21 14:38:45 · 458 阅读 · 0 评论 -
opencv-python将摄像头图像实时发送给Unity
Unity代码(服务端)using OpenCVForUnity.CoreModule;using OpenCVForUnity.ImgcodecsModule;using OpenCVForUnity.UnityUtils;using System;using System.Net;using System.Net.Sockets;using System.Text;using System.Threading;using UnityEngine;public class net原创 2021-05-27 11:40:48 · 3588 阅读 · 35 评论 -
Opencv-python 使用addWeighted图像背景更新
图像背景更新一般用createBackgroundSubtractorKNN算法来更新背景,但此算法耗时较长,在视频应用中会出现卡顿。使用图像融合的方法,速度较快。import cv2import numpy as np cap = cv2.VideoCapture(0)ret, privous_frame = cap.read()while(1): ret, frame = cap.read() cv2.imshow("capture", frame) privous_frame原创 2021-01-21 18:17:01 · 432 阅读 · 0 评论 -
python DES和MD5加密
安装pycryptodomepip install pycryptodome -i https://pypi.douban.com/simple加密import base64from pyDes import * #pip install pyDesclass DEncry: def __init__(self): self.Des_Key = "ssssdddd" self.Des_IV = "22334455" # 加密 ...原创 2020-11-24 21:04:51 · 289 阅读 · 0 评论 -
Python异步TCP自动重连客户端
import os,sys,timeimport socketimport errnofrom time import sleep def main(): client = socket.socket(socket.AF_INET,socket.SOCK_STREAM) client.setblocking(0) connect = False while True: try: if connect == ..原创 2020-10-23 14:53:35 · 668 阅读 · 0 评论 -
Python TCP客户端自动重连
import os,sys,timeimport socketdef main(): client = socket.socket(socket.AF_INET,socket.SOCK_STREAM) client.settimeout(5) connect = False while True: try: if connect == False: client.conn.原创 2020-10-22 17:35:14 · 871 阅读 · 1 评论 -
OpenCV-Python图像叠加
import cv2import numpy as np#要叠加的图片大小tw = 200th = 200#读取靶子图像target = cv2.imread('target.png', cv2.IMREAD_COLOR)target = cv2.resize(target, (th, tw))cap = cv2.VideoCapture(0)while(1): # get a frame ret, frame = cap.read() sp = frame.shape...原创 2020-10-20 17:05:01 · 1434 阅读 · 2 评论 -
python-opencv在世界地图图片上标记经纬度点
import cv2import numpy as npfrom matplotlib import pyplot as pltfrom PIL import Imageimport pytesseractimport math;def latLon2Imagexy(lat, lon, w, h): #lon = lon * 0.9 #lat = lat * 1.05 x = w * (lon +180) / 360 y = h * (1- (lat.原创 2020-09-02 18:28:22 · 1564 阅读 · 0 评论 -
opencv-python文字识别
import cv2import numpy as npfrom matplotlib import pyplot as pltfrom PIL import Imageimport pytesseract img_rgb = cv2.imread('USNI.jpg')#模拟匹配,将方块以黑色填充,后面二值化就可以以过滤掉img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)template = cv2.imread('Templ...原创 2020-09-02 15:56:42 · 3068 阅读 · 5 评论 -
opencv-python模板匹配
import cv2import numpy as npfrom matplotlib import pyplot as pltimg_rgb = cv2.imread('USNI.jpg')img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)template = cv2.imread('Template.jpg',0)w, h = template.shape[::-1]res = cv2.matchTemplate(img_gray.原创 2020-09-02 11:21:22 · 273 阅读 · 0 评论 -
ImageAI训练自定义数据总结
1.先按《Win10下ImageAI-gpu(tensorflow-gpu)环境安装(cuda及cuDNN自动安装)及实时对象检测》安装好。给图片进行对象标注使用LabelImage工具。下载pretrained-yolov3.h5,放到temp.py同一目录下。准备自己的数据集(我这里文件夹是net)放到temp.py同一目录下。数据集目录结构必须包含train和validationtrain文件夹下必须包含images和annotations.其中image用于存放图片,a原创 2020-07-24 16:34:00 · 1061 阅读 · 5 评论 -
使用pyinstaller打包出现了UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xce
在cmd下(编译exe的那个控制台命令行黑框),直接输入:chcp 65001然后回车,重新执行此前的编译代码即可。原创 2020-05-31 16:52:48 · 811 阅读 · 0 评论 -
python-OpenCV程序打包后无法正常运行的解决方法
将python下的OpenCV的DLL复制以打包后的目录中,与exe位于同一目录即可。D:\ProgramData\Anaconda3\Lib\site-packages\cv2\opencv_videoio_ffmpeg420_64.dll原创 2020-05-23 20:46:33 · 2420 阅读 · 4 评论 -
pyinstaller程序发布问题记录
注:下文中wslng为用户文件夹,注意替换1.FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\wslng\\dist\\main\\astor\\VERSION'将C:\Users\wslng\AppData\Local\Programs\Python\Python36\Lib\site-packages\astor文件夹复制C:\Users\wslng\dist\main目录下即可。2.执行如下命令p原创 2020-05-23 18:33:45 · 248 阅读 · 0 评论 -
opencv-python在pySide2 pyQt5中显示图像
import cv2import sysfrom PySide2.QtCore import QTimer, QSizefrom PySide2.QtGui import QImage, QPixmapfrom PySide2.QtWidgets import QWidget, QLabel, QPushButton, QVBoxLayout, QApplicationclass MainApp(QWidget): def __init__(self): QW...原创 2020-05-13 20:16:54 · 5344 阅读 · 11 评论 -
ImageAI实时检测自定义对象(自己训练的数据)
import cv2,osfrom imageai.Detection.Custom import CustomObjectDetection execution_path = os.getcwd()detector = CustomObjectDetection()detector.setModelTypeAsYOLOv3()detector.setModelPath("hololens-ex-60--loss-2.76.h5")detector.setJsonPath("det...原创 2020-05-13 16:13:24 · 960 阅读 · 1 评论 -
Python把16进制字符串转换为ascii码字符串
int("0x31", 16)将16进制转换为10进制:>>> int("0x31",16)49但是要将其转换为字符,您应该改用以下chr(...)函数:>>> chr(49)'1'将它们放在一起(在第一个字母上):>>> chr(int("0x53", 16))'S'并处理整个列表:>>> [chr(int(i, 16)) for i in "0x53 0x48 0x41 0x53 0x48原创 2020-05-11 22:33:16 · 6741 阅读 · 0 评论 -
Python使用pyside2编写界面
本次测试以Anaconda为Python安装工具,Pycharm为代码编写工具。如果无法运行,参考这里的解决办法。1.安装pyside2pip install pyside2 -i https://pypi.douban.com/simple/2.打开Qt Designer(路径:D:\ProgramData\Anaconda3\Lib\site-packages\PySide2\designer.exe),3.随便拖几个控件,保存为test.ui(绝对路径:D:\Tmp\tes.原创 2020-05-11 15:56:00 · 5678 阅读 · 0 评论 -
解决PySide2的This application failed to start because no Qt platform plugin could be initialized问题
学习使用PySide2,按照官网说明,一步一步做,报错“This application failed to start because no Qt platform plugin could be initialized”解决办法在代码中加入如下代码即可import sys,osimport PySide2dirname = os.path.dirname(PySide2.__file__)plugin_path = os.path.join(dirname, 'plugins',原创 2020-05-11 13:27:31 · 2225 阅读 · 11 评论 -
Colaboratory读取谷歌云盘(Google drive)中的数据(2020年3月28日更新)
1.运行如下代码,获取Google drive授权from google.colab import drivedrive.mount('/content/drive')2.点击链接,获取授权码。3.粘贴授权码,加载Drive目录4.使用路径...原创 2020-03-28 17:04:13 · 1369 阅读 · 0 评论 -
Win10下ImageAI-gpu训练自己的数据集
1.先按《Win10下ImageAI-gpu(tensorflow-gpu)环境安装(cuda及cuDNN自动安装)及实时对象检测》安装好。2.下载pretrained-yolov3.h5,放到temp.py同一目录下。3.下载hololens数据集,放到temp.py同一目录下。4.编写代码开始训练。from imageai.Detection.Custom import De...原创 2020-03-27 21:31:07 · 1174 阅读 · 0 评论 -
在Colaboratory中使用ImageAI训练自己的数据集
1.按《在Google Colaboratory测试imageAI》中介绍的方法,新建笔记本。2.点击菜单【代码执行程序】【更改运行时类型】修改运行时类型为GPU(否则会报错:ImportError: libcublas.so.10.0: cannot open shared object file: No such file or directory)3.下载pretrained-y...原创 2020-03-27 11:16:22 · 733 阅读 · 0 评论 -
Win10下ImageAI-gpu(tensorflow-gpu)环境安装(cuda及cuDNN自动安装)及实时对象检测
注:1.imageai目前(2020年03月23日)不支持tensorflow2.0,官方帮助文档:https://imageai.readthedocs.io/en/latest/detection/index.html 2.网卡必须为Navidia,并且计算能力为3.0以上才行。计算能力查询:https://developer.nvidia.com/cuda-gpus#coll...原创 2020-03-27 21:31:26 · 1930 阅读 · 0 评论 -
在Google Colaboratory测试imageAI
1. 打开Colaboratory2. 点击左上角的【文件】【新建文件夹】3. 点击【代码执行程序】【更改运行时类型】,修改为为GPU4. !wget https://github.com/OlafenwaMoses/ImageAI/releases/download/1.0/yolo.h55. !wget https://github.com/OlafenwaMoses/Ima...原创 2020-03-15 23:11:33 · 300 阅读 · 0 评论 -
最简单神经网络实现手写数字的识别
纯python写的最简单的三层神经网络,只有输入层、一个隐藏层、输出层,使MNIST100条数据进行训练,10条数据进行测试。 测试环境Win10 Python3.7.5 pyCharm 100条训练数据:https://raw.githubusercontent.com/makeyourownneuralnetwork/makeyourownneuralnetwork/master/mnis...原创 2019-11-23 08:44:10 · 2065 阅读 · 2 评论 -
Python安装numpy库
1.安装python。安装是否成功测试 开始-》运行->cmd: python2.开始-》运行->cmd: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy其中https://pypi.tuna.tsinghua.edu.cn/simple为清华大学pip源, 安装速度较快。3.测试numpy安装是否成...原创 2019-11-21 22:42:15 · 1870 阅读 · 0 评论