![](https://img-blog.csdnimg.cn/20190918140158853.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
python学习记录
python
Bean_zx
哈哈哈
展开
-
qwen大模型,推理速度慢,单卡/双卡速度慢,flash-attention安装,解决方案
阿里的通义千问qwen大模型,推理速度慢,单卡/双卡速度慢。原创 2023-10-23 15:08:14 · 9166 阅读 · 13 评论 -
python threading 停止和暂停线程
python的threading包,暂停线程、恢复线程,和停止线程的方法原创 2023-02-08 10:40:08 · 5638 阅读 · 0 评论 -
asyncio异步条件下,再开启一个新线程时报错RuntimeError: There is no current event loop in thread ‘Thread-2‘.
asyncio异步条件下,开线程时报错 RuntimeError: There is no current event loop in thread 'Thread-2'.,解决方案原创 2022-12-07 11:07:12 · 856 阅读 · 0 评论 -
在linux脚本中,激活anaconda环境,source activate env,提示source: activate: file not found,解决方案
在shell脚本中,激活python虚拟anaconda环境原创 2022-11-24 17:55:15 · 5479 阅读 · 3 评论 -
python, pydantic, 接收form表单请求数据
python,搭建http服务器,接收form形式的请求数据原创 2022-11-24 14:44:49 · 1046 阅读 · 0 评论 -
python, pydantic, 提交文件file, form表单
python, 通过form表单提交file文件,给http接口原创 2022-11-24 14:37:50 · 622 阅读 · 0 评论 -
【python】爬虫获取指定类型的图片
python爬虫获取指定类型的图片原创 2022-09-22 11:46:38 · 380 阅读 · 0 评论 -
python使用kafka模块,报错SyntaxError: invalid syntax
kafka python报错问题解决原创 2022-07-13 15:20:34 · 1749 阅读 · 2 评论 -
python多线程与互斥锁、递归锁、信号量
多线程转载 2022-03-11 15:30:55 · 126 阅读 · 0 评论 -
pip安装包时,报错ModuleNotFoundError: No module named ‘_ctypes‘的解决办法
安装时报错ModuleNotFoundError: No module named '_ctypes’的解决办法原因:缺少libffi-devel1、执行如下命令:yum install libffi-devel 2、python从"./configure …"重新安装再重新make原创 2021-12-03 17:49:58 · 1901 阅读 · 0 评论 -
fastapi搭建的接口,内存消耗过大,虚拟内存不断增大,res,virtual不断增大,解决方案python
python采用fastapi搭建的服务端,处理http接口,遇到虚拟内存和内存不断增大,res、virtual不断增大现象:在服务器开启阶段,每一次请求就会导致内存消耗不断增大,增加量恐怖解决方案:将fastapi的调用方法改为异步函数async def,这也是fastapi的精髓,之前没有注意from pydantic import BaseModelfrom fastapi import FastAPIimport uvicornapp = FastAPI()class Gong原创 2021-10-25 14:51:59 · 2855 阅读 · 3 评论 -
pyinstaller 打包程序时 Module ‘PyQt5‘ has no attribute ‘__version__‘
pyinstaller -F a.pyAttributeError: Module 'PyQt5' has no attribute '__version__'原因:这是因为pyinstaller打包的时候,需要PyQt5解决方法:pip installl PyQt5原创 2021-10-14 10:55:03 · 1655 阅读 · 0 评论 -
c++和python 调用usb摄像头或本机摄像头,并保存视频
C++部分`#include<opencv2/opencv.hpp>#include<stdlib.h>using namespace cv;void main(){ Size videoSize(680, 480); VideoCapture cap(CV_CAP_DSHOW + 0); cap.open(1); //打开摄像头 if (!cap.isOpened())//如果视频不能正常打开则返回 return; cvWaitKey(30); int fp原创 2021-09-19 19:09:07 · 1288 阅读 · 0 评论 -
train.py 训练过程中 IndexError: index 1 is out of bounds for dimension 4 with size 1
报错:IndexError: index 1 is out of bounds for dimension 4 with size 1训练自己的模型过程中,出现以上错误原因:数组越界一般是类别文件没有修改voc_classes.txt中添加子的类别voc_classes.txtaeroplanebicyclebirdboatbottlebuscarcatchaircowdiningtabledoghorsemotorbikepersonpottedplants原创 2021-08-25 10:40:31 · 9377 阅读 · 10 评论 -
关于TP,TN,FP,FN的笔记
在深度学习中,经常会用到TP, FP, TN, FN的概念。这里以车car类别举例TP:真实情况是属于car类别,并且正确识别为car类别FN:真实情况是car类别,但是没有被识别为car类别FP:真实情况是不属于car类别,但是被识别为car类别TN:真实情况是不属于car类别,并且识别时没有被识别为car类别...原创 2020-08-19 18:50:14 · 521 阅读 · 0 评论 -
制作数据集(VOC2007)中,批量修改图片JPEGImages文件夹的文件名字
import osclass BatchRename: """ 批量重命名文件夹中的图片文件 """ def __init__(self): # 我的图片文件夹路径horse self.path = '/home/ghz/fast-rcnn/data/VOCdevkit/VOC2007/horse' def rena...原创 2019-11-01 14:28:20 · 909 阅读 · 4 评论 -
将yolo的.weights文件转换为keras、tensorflow模型所需的.h5文件的教程
将yolo的.weights文件转换为keras、tensorflow模型所需的.h5文件的教程提前下载准备.weights文件,可以去darknet官网下载。下载地址为:darknet地址通过keras_yolo自带的convert.py文件,即可转换,keras_yolo的下载地址:github地址转换过程简单...原创 2019-11-13 10:13:29 · 2276 阅读 · 0 评论 -
Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure。解决方法
#把你的代码改成用 TkAgg 的后端(或其他后端可能也行):import matplotlibmatplotlib.use(‘TkAgg’) #这句是重点。加上即可以解决import matplotlib.pyplot as plt原创 2019-09-10 17:06:24 · 1488 阅读 · 0 评论 -
from scipy.misc import imread 报错原因
首先排除包的安装,numpy,Pillow,scipy并且保证是最新版的。如果不是包的问题,可能是numpy的问题,先卸载numpy,再安装mkl,再重新安装numpy亲测解决!...原创 2019-08-19 20:18:14 · 1012 阅读 · 0 评论 -
pytorch安装指定版本,cuda指定版本,torchvision指定版本
本人需要安装cuda=9.2 pytorch=1.2.0conda install pytorch==1.2.0 torchvision==0.4.0 cudatoolkit=9.2 -c pytorch原创 2021-08-02 15:42:12 · 2295 阅读 · 0 评论 -
cannot import name 'moving_averages'
这是因为tensorflow的版本不对,我装的的GPU版本。我将版本换成1.6.0就解决了原创 2019-10-22 17:24:36 · 3543 阅读 · 3 评论 -
python使用OpenCv ,语句cv2.findContour()报错,ValueError: not enough values to unpack (expected 3, got 2)
python使用OpenCv ,语句cv2.findContour()报错,ValueError: not enough values to unpack (expected 3, got 2)是由于安装新版版的OpenCV解决方法一:OpenCv版本降级3.4.3.18(楼主用的OpenCv的4.0以上版本)解决方法二:新版本的OpenCv只能返回两个参数contours, hierarc...原创 2019-10-09 11:01:40 · 293 阅读 · 0 评论 -
efficientdetd d0-d7 pth文件资源
百度网盘链接链接:https://pan.baidu.com/s/1xDwm3pFQWM3T3kGr2H-rzA提取码:ihgm阿里云盘链接https://www.aliyundrive.com/s/3eeT4JyvpA7原创 2021-08-23 10:42:08 · 205 阅读 · 0 评论 -
[enforce fail at inline_container.cc:137] . PytorchStreamReader failed reading zip archive:解决方法
pytorch 或者libtorch报错详细如下terminate called after throwing an instance of 'c10::Error' what(): [enforce fail at inline_container.cc:137] . PytorchStreamReader failed reading zip archive: failed finding central directoryframe #0: c10::ThrowEnforceNotMet(原创 2021-08-12 17:34:46 · 2584 阅读 · 5 评论 -
如何查看神经网络结构,查看pb,config,onnx,h5,hd5,hdf5,json,keras,mlmodel,caffemodel,model等
标题如何查看神经网络结构,查看pb,config,onnx,h5,hd5,hdf5,json,keras,mlmodel,caffemodel,model等查看神经网络文件的网络结构https://github.com/lutzroeder/Netronhttps://github.com/lutzroeder/NetronNetron下载地址已给出Netron 支持 ONNX (.on...原创 2020-01-03 17:39:19 · 2280 阅读 · 2 评论 -
python程序打包成exe可执行文件的过程
python程序打包成exe可执行文件的过程python程序打包成exe可执行文件的过程安装pyinstall包,pip3 install pyinstaller若提示enum错误,直接pip uninstall enum即可环境变量里,path要加上python的scripts文件夹,例如:D:\anaconda\Scripts\,最后的斜杠不可缺少,缺少会提示pyinstaller为...原创 2020-01-03 17:18:34 · 182 阅读 · 0 评论