Python
dragon in sky
这个作者很懒,什么都没留下…
展开
-
GPS经纬度 转化为 M
常识:赤道半径为6378.140千米=6378140米,极半径为 6356.755千米=6356755米圆的周长=2πR南北距离(相同经度上两点,比较纬度):(Δ纬度)*2πR/360 = (Δ纬度)*110946.65356即南北差1度 =110946.65356米注:此时R为极半径东西距离(相同纬度上两点,比较经度):不同纬度的纬度圈大小不同纬度圈大小:cos(90 - 纬度)* R<赤道圆>东西距离: (Δ经度) * cos(90 - 纬度)* R<赤道圆原创 2020-05-10 20:40:50 · 2456 阅读 · 0 评论 -
python 模拟键盘输入 自制游戏手柄
模拟程序# direct inputs# source to this solution and code:# http://stackoverflow.com/questions/14489013/simulate-python-keypresses-for-controlling-a-game# http://www.gamespp.com/directx/directInputKey...原创 2020-05-05 19:36:33 · 3183 阅读 · 0 评论 -
神经网络基础
1.通过激活函数正向计算activation="relu",#激活函数2.神经网络训练 optimizer="sgd", # 模型的求解方法,调整方法 # 梯度下降3.深度神经网络:层次比较深的神经网络4.归一化与批归一化Z-score:(x - 均值) / 方差5.Dropout把结点设成0之...原创 2020-02-02 19:22:29 · 93 阅读 · 0 评论 -
Tensorflow keras 回归模型
import matplotlib as mplimport matplotlib.pyplot as plt# %matplotlib inlineimport numpy as npimport sklearnimport pandas as pdimport osimport sysimport timeimport tensorflow as tffrom tensor...原创 2020-02-02 16:59:56 · 189 阅读 · 0 评论 -
Tensorflow keras 归一化 和 回调函数
import matplotlib as mplimport matplotlib.pyplot as plt# %matplotlib inlineimport numpy as npimport sklearnimport pandas as pdimport osimport sysimport timeimport tensorflow as tffrom tensor...原创 2020-02-02 15:51:36 · 2326 阅读 · 0 评论 -
Tensorflow tfkeras
分类问题与回归问题分类问题预测的是类别,模型的输出是概率分布[0.2,0.7,0.9]回归问题预测的是值,模型的输出是一个实数值如预测房价目标函数·...原创 2020-02-01 15:36:46 · 268 阅读 · 0 评论 -
Python openCV 人脸识别 入门
import cv2# 读图片img = cv2.imread(r"D:\Desktop\hk1.png")# 按比例改变大小img = cv2.resize(img, (int(img.shape[1]/3) , int(img.shape[0]/3) ))# 转灰度gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)# 导训练数据face_ca...原创 2020-01-27 20:15:11 · 175 阅读 · 0 评论 -
Python 继承 组合
继承import random as rclass Fish: def __init__(self): self.x = r.randint(0,10) self.y = r.randint(0,10) def move(self): self.x -= 1 print('我的位置上: ',self.x,s...原创 2020-01-27 13:44:19 · 148 阅读 · 0 评论 -
Python self __(双下划线)
>>> class ball: def __init__(self,name): self.name = name>>> ball = ball('qwe')>>> ball.name'qwe'>>> class Ball: def setname(self,name): self.name = ...原创 2020-01-24 22:35:13 · 763 阅读 · 0 评论 -
Python 面向对象编程(OO)
封装class Hankai: # 大写字母开头代表类,小写则为函数 # 属性 age = 21 weight = 85 mouth = 'big' live = True # 方法 def climb(self): print('一点一点网上趴') def run(self): print('上坡了...原创 2020-01-23 16:43:52 · 148 阅读 · 0 评论 -
Try except finally raise
try:# int('qwe') f = open('我为什么是一个文件.txt','w') print(f.write('我存在了!!!')) sum = 1+'1' f.close()#except OSError as reason:# print('文件出错\n错误的原因是: '+str(reason))#except TypeError...原创 2020-01-21 18:16:58 · 98 阅读 · 0 评论 -
Python pickle
链接 https://www.jianshu.com/p/038eac4f1f69简单使用>>> import pickle>>> list1=[123,12,3.14,'韩凯',['123']]>>> pickle_file = open('my_list.pkl','wb')>>> pickle.dump(li...转载 2020-01-18 12:47:05 · 65 阅读 · 0 评论 -
python import os
import osos.getcwd() # 当前目录os.chdir('D://') # 改变目录os.listdir() # 列出当前目录的所有文件os.mkdir('D://A') # 创建目录os.remove('D://A//123.txt') # 删除文件os.rmdir('D://A') # 删除目录os.makedirs('D://A//AA//AAA') # 创建多...原创 2020-01-18 12:41:33 · 526 阅读 · 0 评论 -
Python 文件操作
读取与关闭精美华文f=open('C:\\text.txt','w')文件读取定位定位到初始位置f.seek(0,0)转载 2020-01-16 12:39:34 · 57 阅读 · 0 评论 -
Python 字典 集合
字典创建,添加,修改dicc1={'hankai':1,'qwe':2,'dsa':3}>>> dicc1['hankai']1>>> dict2=dict((('a',12),('b',13),('c',14),('d',15)))>>> dict2{'a': 12, 'b': 13, 'c': 14, 'd': 15}&g...原创 2020-01-16 12:30:34 · 90 阅读 · 0 评论 -
Python 列表 元组 format
添加一个在后面mix.append('laosah')添加多个在后面mix.extend(['laer','23'])获取数目len(mix)在特定位置添加mix.insert(1,'hankai')str = r'C:\Program Files\FishC\Good\\'print(str)第二个和第三个mix[1:3]删除数组del hk[5]del...原创 2020-01-13 14:49:01 · 695 阅读 · 0 评论 -
Python for range
for i in range(0,28): if i % 2 != 0: print(i) continue i+=2 print(i)结果continue从头依次执行循环break跳出循环""" make a game with python """import randomcounts=3answer = rando...原创 2020-01-11 23:20:20 · 124 阅读 · 0 评论 -
Python 学习 字符串等等
快捷键alt+P 上一句命令引号之用 print('"life is short ,I need Python"')结果“life is short ,I need Python”print ("Let's go!")结果Let’s go!print (''' "Let's go!" ''')结果“Let’s go!”print ('Let\'s go!\nBaby...原创 2020-01-11 20:15:57 · 91 阅读 · 0 评论