![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python基础
mathlxj
复旦大学数院博士毕业,蚂蚁打工人,神经网络方向,目前涉猎计算机视觉、机器学习、推荐系统、TensorRT、自动驾驶、联邦学习、消费信贷、量化等领域。
展开
-
python matplotlib 记号(markers)大全
marker符号描述英文描述"."点point","像素pixel"o"圈circle"v"下三角triangle_down"^"上三角triangle_up"<"左三角triangle_left"<"右三角triangle_right"1"tri_down"2"tri_up"3"tri_left"4"tri_right"8"八边形oc原创 2023-07-11 08:59:22 · 1617 阅读 · 0 评论 -
python matplotlib颜色大全
基本的颜色颜色样式表原创 2023-07-11 08:58:49 · 533 阅读 · 0 评论 -
pytorch转onnx, onnx 12 中没有hardswish opt
转onnx不支持hardswish激活函数的解决方法原创 2022-04-09 16:28:04 · 2169 阅读 · 1 评论 -
PIL:Python图像处理类库的基本用法
from PIL import Imageimport os# 读取图像img_path = './img/test.jpg'img = Image.open(img_path) # 返回一个PIL图像对象print(img)# >>> <PIL.JpegImagePlugin.JpegImageFile image mode=RGB size=440x587 at 0x7FAF480625B0># 转换为灰度图gray_img = img.convert(原创 2020-07-11 17:51:41 · 1063 阅读 · 2 评论 -
Pytorch源码学习之七:torchvision.models.googlenet
0.基本知识torchvision.models.googlenet源码地址GoogLeNet论文地址Inception模块注意,代码中第三个模块采取的3x3卷积而非5x5卷积,不知为何。-GoogLeNet网络结构GoogLeNet网络结构可视化这里注意两个辅助的输出。一、源码import torchimport torch.nn as nnimport torc...原创 2020-03-27 11:16:24 · 2231 阅读 · 0 评论 -
Pytorch源码学习之五:torchvision.models.densenet
0. 基本知识DenseNet论文地址DenseNet加强了每个Dense Block内部的连接,每层输出与之前所有层进行concat连接,使用三个Dense Block的网络示意图如下:每个Block之间使用Transition(BN+ReLU+Conv+AvePool),最后使用全连接层作为分类器.torchvision实现的DenseNet网络结构同论文,如下:1.torchv...原创 2020-03-25 11:35:03 · 3025 阅读 · 1 评论 -
Pytorch源码学习之四:torchvision.models.squeezenet
0.介绍Squeezenet网址torchvision.model.squeeze官方文档主要思想:堆叠Fire模块,每个Fire模块,分别采用1x1和3x3两个分支,最后做拼;,每个Fire的尺寸不变,channel数不变或增加;每个stage的Fire模块之间用nn.MaxPool2d进行下采样;使用卷积层代替FC层,channel数为类别数1.源码import torchimpo...原创 2020-03-24 11:44:59 · 1575 阅读 · 0 评论 -
python将多帧图片组合成视频
import cv2 import osimport cv2import osimport randomimg = cv2.imread('VideoData/1.png') #读取第一张图片fps = 25imgInfo = img.shapesize = (imgInfo[1],imgInfo[0]) #获取图片宽高度信息print(size)fourcc = c...原创 2020-03-22 19:15:29 · 6238 阅读 · 4 评论 -
Python time获取各种格式的时间
一、时间戳格式import timestart = time.time()print(start) # 1584451424 ...原创 2020-03-17 21:36:58 · 472 阅读 · 0 评论 -
Python argparse用法详情
在神经网络训练中,argparse的方法可以让改变参数(模型超参、文件位置、GPU等)更加方便。一、argparse使用步骤Step1 导入argparse模块import argparseStep2 实例化 ArgumentParser() 对象parser = argparse.ArgumentParser(description='Test argparse module...原创 2020-03-17 20:24:21 · 235 阅读 · 0 评论 -
Pytorch源码学习之一: torchvision.models.alexnet
Pytorch源码学习之一 torchvision.models.alexnettorch中一行代码导入的alexnet配置如下:64@11x11 stride=4 + ReLU + Maxpooling 3x3 stride=2192@5x5 stride=1 + ReLU + MaxPooling 3x3 stride=2384@3x3 stride=1 + ReLU256@3...原创 2020-03-17 16:39:01 · 2767 阅读 · 0 评论 -
python的异常类型
1.内建的异常类异常类含义Exception所有异常的基类AttributeError特性引用或赋值失败引发IOError试图打开不存在文件(包括其他情况)时引发IndexError使用序列中不存在的索引时引发KeyError在使用映射时不存在的键时引发NameError在找不到名字(变量时引发)SynaxError在代码为错...原创 2019-10-08 20:57:28 · 219 阅读 · 0 评论 -
python类的基本操作
本节给出类的基本操作函数,方法查阅备用。0.定义类class student(): def init(self): self.name = 'no name' def sayname(self): print('Hello, my name is ', self.name)class boyA(student): def init(se...原创 2019-10-08 20:28:41 · 362 阅读 · 0 评论 -
LeetCode刷题自己写的Python3代码答案(1-10)
笔者也是菜鸟一枚,仅要求把题目做出,对算法的优化没有能力做太多处理,希望大家给出改进意见.1. Two SumGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would...原创 2019-04-01 11:16:45 · 848 阅读 · 0 评论 -
Python3刷LeetCode基础用法回顾汇总(持续更新)
笔者从2019年三月开始日刷一条LeetCode题目,LeetCode汇总了公司面试中常见的题目,免费题目有很多,分Easy,Medium,Hard等级,由于笔者对Python的很多常见用法未做过总结,借此机会总结用到的基本用法,算作学习笔记使用.LeetCode的网址为:https://leetcode.com/建议新手都可以从刷题开始,一开始的代码肯定不是最优的,在有好的想法时可以提升代码...原创 2019-03-31 12:16:29 · 2252 阅读 · 0 评论 -
使用matplotlib绘图库的pyplot快速绘图
使用matplotlib绘图库的pyplot快速绘图matplotlib是Python最常用的绘图库,在结果或数据可视化中常用pyplot实现快速绘图,下面参考张若愚主编的Python科学计算(第2版)介绍pyplot绘图:导入pyplot模块import numpy as npimport matplotlib.pyplot as plt定义函数x = ...原创 2018-08-03 12:59:38 · 2448 阅读 · 0 评论