资源简介
根据去雾算法对图像中的PM2.5浓度进行分析,利用机器学习的方法建模进行估计

代码片段和文件信息
#-*- coding:utf-8 -*-
from urllib.request import urlretrieve
import urllib.parse
import urllib3
import requests
import http.cookiejar
from lxml import etree
from bs4 import BeautifulSoup
import pymysql
import os
import re
conn = pymysql.connect(host=‘localhost‘user=‘root‘passwd=‘w904403‘db=‘pm25data‘port=3306charset=‘utf8‘)
cursor = conn.cursor()
#图片储存路径
local=“D:\\100D5300\\“
# 各城市的href
city_href={}
# 各城市的名称
city_name={}
UserAgent=‘Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/65.0.3325.181 Safari/537.36‘
citys_url=[‘https://tianqi.moji.com/liveview/china/henan‘]
ee=[‘郑州‘]
#得到各城市信息
def getCitys(city_url):
#city_url=“https://tianqi.moji.com/liveview/china/chongqing“
city_header={ ‘User-Agent‘:UserAgent}
city_req = urllib.request.Request(city_url None city_header)
city_response = urllib.request.urlopen(city_req)
city_page = city_response.read().decode(‘utf-8‘)
tree = etree.HTML(city_page)
for one in tree.xpath(‘//div[@class=“city_hot“]‘):
city_href= one.xpath(‘.//li//a/@href‘)
city_name= one.xpath(‘.//li//a/text()‘)
print(len(city_href))
return city_hrefcity_name
#得到图片的拍摄时间和地点信息
def get_imgMessage(IDcitynum):
header_ = {‘User-Agent‘:UserAgent }
files = os.listdir(‘D:\\100D5300\\temp‘)
for i in ID:
# 每张图片的url,从中找到拍摄时间和地点
img_url = ‘https://tianqi.moji.com/liveview/picture/‘ + ID[i]
req_ = urllib.request.Request(img_url None header_)
response_ = urllib.request.urlopen(req_)
the_page_ = response_.read().decode(‘utf-8‘)
soup_ = BeautifulSoup(the_page_ “html.parser“)
# 找到拍摄时间
img_date = soup_.find_all(id=‘picture_info_date‘)
# 找到拍摄地点
img_place = soup_.find_all(id=‘picture_info_addr‘)
try:
img_dateMess = img_date[0].get_text().split(‘ ‘)
except:
continue
aroundTime = img_dateMess[1].split(‘:‘)
# 根据拍摄时间对图片进行过滤
hour_time = aroundTime[0].split(‘M‘)
theImg = soup_.find_all(‘div‘ class_=‘scenery_image_detail‘)
# 选择拍摄时间在上午七点到下午五点之间的
if ((hour_time[0] == ‘A‘ and int(hour_time[1]) >= 9) or (hour_time[0] == ‘P‘ and int(hour_time[1]) <= 4)):
# 时间段
#print(‘时间:‘+aroundTime[0])
# 年-月-日
#print(‘年月日:‘+img_dateMess[0])
‘‘‘
以下是重要函数
‘‘‘
# 图片url
for Img in theImg:
link = Img.find(‘img‘)[‘src‘]
#将时间字符串转为标准格式
tempList=img_dateMess[0].split(‘-‘)
if len(tempList[1])==1:
tempList[1]=‘0‘+tempList[1]
if len(tempList[2])==1:
tempList[2] = ‘0‘ + tempList[2]
img_date = tempList[0]+‘-‘+tempList[1]+‘-‘+tempList[2]
totalname=aroundTime[0]+‘#‘+city_name[cit
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-06-18 13:46 基于机器学习的图像Pm2.5分析系统\
目录 0 2018-05-19 16:53 基于机器学习的图像Pm2.5分析系统\source\
目录 0 2018-07-24 09:48 基于机器学习的图像Pm2.5分析系统\source\模型搭建\
文件 4084 2018-07-24 09:48 基于机器学习的图像Pm2.5分析系统\source\模型搭建\project1.py
目录 0 2018-05-19 16:56 基于机器学习的图像Pm2.5分析系统\source\模型搭建\非Keras神经网络方式\
文件 977 2018-04-28 17:09 基于机器学习的图像Pm2.5分析系统\source\模型搭建\非Keras神经网络方式\project2_SVM.py
文件 6505 2018-05-08 06:46 基于机器学习的图像Pm2.5分析系统\source\模型搭建\非Keras神经网络方式\TF_project1.py
文件 1104 2018-05-08 03:04 基于机器学习的图像Pm2.5分析系统\source\模型搭建\非Keras神经网络方式\project3_Bayes.py
目录 0 2018-05-19 16:59 基于机器学习的图像Pm2.5分析系统\source\模型与界面接口\
文件 2632 2018-05-10 05:09 基于机器学习的图像Pm2.5分析系统\source\模型与界面接口\Image2Pm.py
文件 895208 2018-05-08 07:04 基于机器学习的图像Pm2.5分析系统\source\模型与界面接口\pm_model.h5
文件 1548012 2018-05-08 09:36 基于机器学习的图像Pm2.5分析系统\source\模型与界面接口\testData.npz
目录 0 2018-05-20 02:53 基于机器学习的图像Pm2.5分析系统\source\特征提取\
文件 7392 2018-05-08 07:31 基于机器学习的图像Pm2.5分析系统\source\特征提取\PM25Test.py
目录 0 2018-05-20 02:53 基于机器学习的图像Pm2.5分析系统\source\特征提取\data\
文件 7920128 2018-05-08 09:05 基于机器学习的图像Pm2.5分析系统\source\特征提取\data\docDataFile.npy
文件 10028 2018-05-08 09:05 基于机器学习的图像Pm2.5分析系统\source\特征提取\data\docLabelFile.npy
目录 0 2018-05-19 16:58 基于机器学习的图像Pm2.5分析系统\source\界面\
文件 8153 2018-05-10 07:23 基于机器学习的图像Pm2.5分析系统\source\界面\form.py
目录 0 2018-05-19 16:58 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\
文件 7765 2018-05-09 06:07 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\back.jpg
文件 4287 2017-06-10 11:16 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\searchon.png
文件 130982 2018-05-09 08:14 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\photoInput.gif
文件 19491 2018-05-09 06:02 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\histLogo.png
文件 33085 2018-05-09 06:05 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\pieLogo.png
文件 5321 2018-05-09 05:59 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\fileLogo.png
文件 40446 2018-05-09 06:00 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\LOGO.png
文件 3280 2018-05-09 14:51 基于机器学习的图像Pm2.5分析系统\source\界面\imageSrc\quit.png
文件 6172 2018-05-10 10:57 基于机器学习的图像Pm2.5分析系统\source\界面\openfile.py
目录 0 2018-05-20 02:52 基于机器学习的图像Pm2.5分析系统\source\数据采集\
文件 1620 2018-04-29 08:01 基于机器学习的图像Pm2.5分析系统\source\数据采集\moveFile.py
............此处省略8个文件信息
相关资源
- 冈萨雷斯 数字图像处理 源代码(m文
- qt图像处理
- 血液图像处理—细胞识别
- VC数字图像处理课程设计
- 图像处理作业C 源代码
- ppt 机器学习.ppt
- Logistic回归总结非常好的机器学习总结
- Convex Analysis and Optimization (Bertsekas
- SAR图像处理1
- Graphics Magic图像处理魔术师,含Delph
- 机器学习个人笔记完整版v5.2-A4打印版
- 铝合金方波交流TIG焊熔池图像处理
- JUNIOR:粒子物理学中无监督机器学习
- 基于图像处理的智能车寻迹算法设计
- 语料库.zip
- 中国科学技术大学 研究生课程 机器学
- 遗传算法越野小车unity5.5
- 医学超声图像处理研究+哈尔滨工业大
- 吴恩达机器学习编程题
- shape_predictor_68_face_landmarks.dat.bz2 68个标
- 机器学习实战高清pdf,中文版+英文版
- 友锋图像处理系统v3.rar(破解版
- 李宏毅-机器学习(视频2017完整)
- 机器学习深度学习 PPT
- 麻省理工:深度学习介绍PPT-1
- Wikipedia机器学习迷你电子书之四《D
- 图像处理代码
- Learning From Data Yaser S. Abu-Mostafa
- 图片-视频互换程序
- 基于图论的图像处理
评论
共有 条评论