获取Avrix上Computer Vision and Pattern Recognition的论文,进一步进行统计分析。

此文主要记录我在18年寒假期间,收集Avrix论文的总结

寒假生活题外

  在寒假期间,爸妈每天让我每天跟着他们6点起床,一起吃早点收拾,每天7点也就都收拾差不多。
  早晨的时光是人最清醒的时刻,而且到十点左右才开始帮忙做中午饭,中间这么大把的时光,我就来做做自己喜欢的事情。小外甥女也回来,但她每天只有10点起床后才跟我玩,真希望她能早起背背古诗文。

概述

  整个项目由数据采集(Python),数据存储(Mysql),数据可视化(C#)组成。
  数据采集主要负责从网络上,获取Avrix的论文基本信息与论文下载地址。将其存储至MySQL,此过程中将分析Avrix上网页的结构,依靠依然是Chrome进行。
  数据存储食用的MySQL,其实我蛮想用SqlServer的,之前的东家是SqlServer,操作极其稳定与简单,速度很快,功能很全。新东家节约成本给我们多发点工资,用起来MySql了,使用了一段时间,大体上差不多,数据转存备份比转存比SqlServer复杂一些。
  数据可视化,目前做的部分是C#编译的一个查询界面,可以查询到相应的论文,可以从数据库中检索出论文,并链接指向的PDF文件,使用系统默认软件打开PDF。

分项陈述

pyhon数据采集部分

  直接上代码

# -*- coding:utf-8 -*-#作者:Qt.chao
#时间:2018/02/20
#综述:从Cornell University的图书馆Arvix主页上,获取计算机领域Computer Vision and Pattern Recognition的相关论文import urllib.request
import pymysql
from bs4 import BeautifulSoup
import requests
import time
import re
import os# 数据库连接基础类
class Conn_Mssql:#查询Mysql使用sql语句def Select_mssql(strsql):#数据库连接信息conn = pymysql.connect("localhost", "**username**", "**password**", "internetdaq", charset="utf8")cur = conn.cursor()cur.execute(strsql)return cur#插入与更新sql语句使用def InsertOrUpdate_mssql(strsql):# 数据库连接信息conn = pymysql.connect("localhost", "**username**", "**password**", "internetdaq", charset="utf8")cur = conn.cursor()cur.execute(strsql)conn.commit()conn.close()return cur#获取网络信息中的信息,并存储
class Get_HttpMessage:# 下载文件函数(根据连接地址,下载至D:StorePDF目录下)def getFile(url):try:file_name = url.split('/')[-1]file_path = "StorePDF\\"+file_nameu = urllib.request.urlopen(url)except :print(url, "url file not found")returnblock_sz = 90192with open(file_path, 'wb') as f:while True:buffer = u.read(block_sz)if buffer:f.write(buffer)else:break# 成功获取下载并打印下载信息print("Sucessful to download" + " " + file_name)# 获取文章中的PDF文档链接地址并下载def getPaperFile(url,file_name,path):try:file_name = url.split('/')[-1]file_path = path +"\\"+file_nameu = urllib.request.urlopen(url)except :print(url, "url file not found")returnblock_sz = 901920with open(file_path, 'wb') as f:while True:buffer = u.read(block_sz)if buffer:f.write(buffer)else:breakprint("Sucessful to download" + " " + file_name)# 从页面中获取论文数据(PDF下载地址与论文的标题等信息)def startGet(strUrl):print('start')# 链接的APPM网络url = strUrlrequest = urllib.request.Request(url)response = urllib.request.urlopen(request)data = response.read()soup = BeautifulSoup(data, "lxml")for link1 in soup.find_all(id=re.compile("dlpage")):for linklist in link1.find_all("dl"):# 论文连接地址相关的信息linklistLpdf = linklist.find_all("dt")# 论文标题作者等相关信息linklistLName = linklist.find_all("dd")# 节点信息长度cont_pdf = len(linklistLpdf)cont_Name = len(linklistLName)if cont_pdf == cont_Name :for linkNum in range(0,(cont_Name)):onepdf = linklistLpdf[linkNum].find_all(href=re.compile("pdf"))if len(onepdf)>0 :# PDF下载的连接地址pdfurl ="https://arxiv.org"+ (onepdf[0])['href']+".pdf"# 文章的详细信息链接地址paper_DetailUrls = linklistLpdf[linkNum].find_all(href=re.compile("abs"))paper_DetailUrl = "https://arxiv.org" + (paper_DetailUrls[0])['href']# 包含论文题目,作者,摘要的节点oneNames = linklistLName[linkNum].find_all(class_="meta")# Paper的编号信息oneName = paper_DetailUrls[0].get_text().replace("'","^",999)# 文章的标题Paper_Titles = oneNames[0].find_all(class_="list-title mathjax")Paper_Title = Paper_Titles[0].get_text().replace("'","^",999)# 文章的作者Paper_Authors = oneNames[0].find_all(class_="list-authors")Paper_Author =""for Paper_Authorlist in Paper_Authors[0].find_all("a"):Paper_Author =Paper_Author +Paper_Authorlist.get_text()+"|"Paper_Author = Paper_Author.replace("'","^",999)Paper_Author = Paper_Author[:-1]# 获取摘要信息time.sleep(5)request2 = urllib.request.Request(paper_DetailUrl)response2 = urllib.request.urlopen(request2)data2 = response2.read()soup2= BeautifulSoup(data2, "lxml")Paper_ABSTRACTS = soup2.find_all(class_="abstract mathjax")if len(Paper_ABSTRACTS)>0 :Paper_ABSTRACT = Paper_ABSTRACTS[0].get_text().replace("'", "^", 999)else:Paper_ABSTRACT = ""# 分类信息PAPER_SUBJECT = ""PAPER_SUBJECTs = soup2.find_all(class_="tablecell subjects")if len(PAPER_SUBJECTs)>0 :PAPER_SUBJECT = PAPER_SUBJECTs[0].get_text().replace("'", "^", 999)else:PAPER_SUBJECT = ""# 获取网页的详细内容信息Paper_Detail = soup2.prettify().replace("'","^",999)Paper_Detail = Paper_Detail.replace("-->","  -->",999)strSQL= "CALL SaveTheCornellUniversityPaper(0,'"+oneName+"','" + Paper_Detail + "','"+pdfurl+"',0,'" + Paper_Title + "','" + Paper_Author + "','" + Paper_ABSTRACT + "','" + PAPER_SUBJECT + "')"strSQL = strSQL.encode('utf8')try:# 存储地址信息Conn_Mssql.InsertOrUpdate_mssql(strSQL)# Get_HttpMessage.getFile(pdfurl)time.sleep(4)print('母页面MySQL存储成功')except:print(strSQL)print('母页面MySQL存储失败')time.sleep(5)# 从主界面获取主界面与分界面的连接信息def selectUrl(strUrl):print(strUrl)Get_HttpMessage.startGet(strUrl)request = urllib.request.Request(strUrl)response = urllib.request.urlopen(request)data = response.read()soup = BeautifulSoup(data, "lxml")for link1 in soup.find_all(id=re.compile("dlpage")):linklists = link1.find_all("small")for linkUrl in linklists[0].find_all("a"):oneUrl = "https://arxiv.org" + linkUrl["href"]print(oneUrl)Get_HttpMessage.startGet(oneUrl)# 从数据库中获取链接地址,下载论文def DownlooadPDFFromMysql(str= ""):urlRows = Conn_Mssql.Select_mssql("SELECT TILE_NAME ,URL from cornell_paper WHERE FLAGE = 0 order BY UID DESC  ;")for urlRow in urlRows:try:Get_HttpMessage.getPaperFile(urlRow[1],urlRow[0]+".pdf","D:\\CornellLibrary")urlRowfiles =urlRow[0].split(":")urlRowfile = urlRowfiles[1]charFILE_PATH = "D:\\\\CornellLibrary\\\\"+urlRowfile+".pdf"strsql = "UPDATE cornell_paper SET FLAGE = 1 , FILE_PATH = '"+ charFILE_PATH +"' WHERE URL = '"+urlRow[1]+"'"Conn_Mssql.InsertOrUpdate_mssql(strsql)print("下载成功"+ charFILE_PATH )except:print("下载失败")finally:time.sleep(3)
# 程序入口
# Arvix相关主页的链接地址
MainUrl = '网络地址'
#  从网页中抓取相关数据信息
Get_HttpMessage.selectUrl(MainUrl)
# 从MySQL数据库中下载论文
Get_HttpMessage.DownlooadPDFFromMysql()

如上即我采集Arvix主页上Computer Vision and Pattern Recognition相关信息信相关信息信,先将网页信息逐个解析,分类存储。将网页的信息存储后,从数据库中,按照标志位,根据下载地址信息,下载相应论文。

MySQL数据存储部分

在整个采集的过程中,是将数据存储在一数据库的一张表中,数据库名称为internetdaq,表(cornell_paper)的结构是:

字段说明 字段名 字段类型
自增无重复编号 UID bigint(20)
保存时间 SAVE_TIME datetime
标题名称 TILE_NAME varchar(200)
存储类型 TYPE int(11)
网页内详细信息 PAGE_DETAIL text
标志位 FLAGE int(11)
文章下载连接地址 URL varchar(255)
文章题目 PAPER_TITLE varchar(1500)
文章作者 PAPER_AUTHOR varchar(500)
文章摘要 PAPER_ABSTRACT varchar(6000)
文章分类 PAPER_SUBJECT varchar(500)
文件路径 FILE_PATH varchar(300)

数据库表结构SQL语句为:

DROP TABLE IF EXISTS `cornell_paper`;
CREATE TABLE `cornell_paper` (`UID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增无重复编号',`SAVE_TIME` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '保存时间',`TILE_NAME` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '标题名称',`TYPE` int(11) DEFAULT NULL COMMENT '存储类型',`PAGE_DETAIL` text COLLATE utf8_unicode_ci COMMENT '网页内详细信息',`FLAGE` int(11) DEFAULT NULL COMMENT '标志位',`URL` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '文章下载连接地址',`PAPER_TITLE` varchar(1500) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '文章题目',`PAPER_AUTHOR` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '文章作者',`PAPER_ABSTRACT` varchar(6000) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '文章摘要',`PAPER_SUBJECT` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '文章分类',`FILE_PATH` varchar(300) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '文件路径',PRIMARY KEY (`UID`)
) ENGINE=InnoDB AUTO_INCREMENT=2445 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

数据库使用的存储结构SQL语句为:

DROP PROCEDURE IF EXISTS `SaveTheCornellUniversityPaper`;
CREATE PROCEDURE SaveTheCornellUniversityPaper(in int_Type int, in CharTILE_NAME varchar(200),
in CharPAGE_DETAIL text,in CharURL varchar(254),in int_Flage int
,in CharPAPER_TITLE varchar(1500)
,in CharPAPER_AUTHOR varchar(500)
,in CharPAPER_ABSTRACT varchar(6000)
,in CharPAPER_SUBJECT varchar(500)
)
MODIFIES SQL DATA
COMMENT'从Cornell大学的论文主页获取论文的信息并存储 int_Type(类型) CharTILE_NAME(标题) CharPAGE_DETAIL(网页信息) CharURL(链接地址) int_Flage(标志位)'
BEGINDECLARE pdfCount int DEFAULT 0;SELECT COUNT(URL) INTO pdfCount from cornell_paper WHERE URL = CharURL;
IF pdfCount< 1 THENINSERT INTO cornell_paper(SAVE_TIME,TYPE,TILE_NAME,PAGE_DETAIL,FLAGE,URL,PAPER_TITLE,PAPER_AUTHOR,PAPER_ABSTRACT,PAPER_SUBJECT)VALUES(NOW(),int_Type,CharTILE_NAME,CharPAGE_DETAIL,int_Flage,CharURL,CharPAPER_TITLE,CharPAPER_AUTHOR,CharPAPER_ABSTRACT,CharPAPER_SUBJECT);
END IF;END

CSharp数据查询部分

此部分主要是用C#从数据库中提取数据,并查询连接查看,主要是为了平时查看论文的具体内容和PDF文档,用于实现的代码也较为简单,没做过多修饰,在接下完善中,可能使用python或C#进行进一步的语义分析与数据可视化,目前主要逻辑如何下所示

主查询界面

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using LCS;namespace PGCL
{/// <summary>/// MainWindow.xaml 的交互逻辑/// </summary>public partial class MainWindow : Window{public MainWindow(){InitializeComponent();}private DataTable dataGridDataTable;/// <summary>/// 窗体登录/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void MainWindow_OnLoaded(object sender, RoutedEventArgs e){}/// <summary>/// 刷新按钮/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void BtnUpdate_OnClick(object sender, RoutedEventArgs e){ShowAllDate();}/// <summary>/// 刷新显示所有数据列表/// </summary>private void ShowAllDate(){DataTable myDataTable = LCS_Lib_DataMySql.Mysql_SelectDataTable("SELECT SAVE_TIME,PAPER_TITLE,PAPER_SUBJECT,URL FROM `cornell_paper` ORDER BY UID DESC ;");dataGridDataTable = new DataTable();dataGridDataTable.Columns.Add("Num", typeof(string));dataGridDataTable.Columns.Add("Save_time", typeof(string));dataGridDataTable.Columns.Add("Title", typeof(string));dataGridDataTable.Columns.Add("Subject", typeof(string));dataGridDataTable.Columns.Add("URL", typeof(string));int IntNum = 1;foreach (DataRow VARDataRow in myDataTable.Rows){DataRow oneDataRow = dataGridDataTable.NewRow();oneDataRow["Num"] = IntNum.ToString();oneDataRow["Save_time"] = VARDataRow["SAVE_TIME"].ToString();oneDataRow["Title"] = VARDataRow["PAPER_TITLE"].ToString();oneDataRow["Subject"] = VARDataRow["PAPER_SUBJECT"].ToString();oneDataRow["URL"] = VARDataRow["URL"].ToString();dataGridDataTable.Rows.Add(oneDataRow);IntNum++;}Paper_datagrid.ItemsSource = dataGridDataTable.DefaultView;}/// <summary>/// 双击表格/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void Paper_datagrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e){DataRowView onreRowView = (DataRowView) Paper_datagrid.SelectedItem;DataRow oneDataRow = onreRowView.Row;DataTable myDataTable = LCS_Lib_DataMySql.Mysql_SelectDataTable("SELECT PAPER_TITLE,PAPER_AUTHOR,PAPER_SUBJECT,PAGE_DETAIL,FILE_PATH" +" FROM cornell_paper WHERE URL = '" + oneDataRow["URL"].ToString() + "' ");winDetail myWinDetail = new winDetail();myWinDetail.strTile = myDataTable.Rows[0]["PAPER_TITLE"].ToString();myWinDetail.strAuthor = myDataTable.Rows[0]["PAPER_AUTHOR"].ToString();myWinDetail.strSubject = myDataTable.Rows[0]["PAPER_SUBJECT"].ToString();myWinDetail.strpage_detail = myDataTable.Rows[0]["PAGE_DETAIL"].ToString();string[] arelinkStrings = myDataTable.Rows[0]["FILE_PATH"].ToString().Split(':');string strLkink = "";if (myDataTable.Rows[0]["FILE_PATH"].ToString().Length>0){strLkink = myDataTable.Rows[0]["FILE_PATH"].ToString();}else{strLkink = "";}myWinDetail.strPDFlink = strLkink;myWinDetail.ShowDialog();}}
}

详细信息查询

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;namespace PGCL
{/// <summary>/// winDetail.xaml 的交互逻辑/// </summary>public partial class winDetail : Window{public winDetail(){InitializeComponent();}/// <summary>/// 题目/// </summary>public string strTile { set; get; }/// <summary>/// 作者/// </summary>public string strAuthor { set; get; }/// <summary>/// 分类标签/// </summary>public string strSubject { set; get; }/// <summary>/// 网页详细信息/// </summary>public string strpage_detail { set; get; }/// <summary>/// PDF连接地址/// </summary>public string strPDFlink { set; get; }/// <summary>/// 关闭按钮/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void Btn_close_OnClick(object sender, RoutedEventArgs e){this.Close();}/// <summary>/// 窗体登录/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void WinDetail_OnLoaded(object sender, RoutedEventArgs e){lab_tile.Content = strTile;lab_author.Content = strAuthor;lab_subject.Content = strSubject;web_detail.NavigateToString(strpage_detail);lab_link.Content = strPDFlink;lab_link.Foreground = new SolidColorBrush(Colors.Blue);}public void SuppressScriptErrors(WebBrowser wb, bool Hide){FieldInfo fiComWebBrowser = typeof(WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic);if (fiComWebBrowser == null) return;object objComWebBrowser = fiComWebBrowser.GetValue(wb);if (objComWebBrowser == null) return;objComWebBrowser.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, objComWebBrowser, new object[] { Hide });}private void Web_detail_OnNavigated(object sender, NavigationEventArgs e){SuppressScriptErrors(web_detail, true);}/// <summary>/// 双击表格/// </summary>/// <param name="sender"></param>/// <param name="e"></param>private void Lab_link_OnMouseDoubleClick(object sender, MouseButtonEventArgs e){Process MyProcess = new Process();MyProcess.StartInfo.FileName = lab_link.Content.ToString();MyProcess.StartInfo.Verb = "Open";MyProcess.StartInfo.CreateNoWindow = true;MyProcess.Start();}}
}

总结

上述即为我这次数据采集的实践,再接下来的学习中,我会向着词频分析与数据可视化方向进一步拓展。上述代码不能直接复制粘贴使用,仅供参考。

posted on 2018-03-18 10:10  Qt超 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/Qt-Chao/p/8575091.html

获取Avrix上Computer Vision and Pattern Recognition的论文,进一步进行统计分析。相关推荐

  1. CVPR(IEEE Conference on Computer Vision and Pattern Recognition)

    论文提交时间:11月份中旬左右会议时间:7月份左右 CVPR 2017: 网址:http://cvpr2017.thecvf.com/ 接受论文数:782

  2. 综述自动驾驶中的计算机视觉Computer Vision for Autonomous Vehicles: Problems, Datasets and State-of-the-Art(上)

    综述原文链接https://arxiv.org/pdf/1704.05519.pdf 17年CVPR上的一篇关于自动驾驶和计算机视觉的综述,比较全面,大体整理一个提纲,重点关注比较新的研究成果,侧重于 ...

  3. Rethinking the inception architecture for computer vision的 paper 相关知识

    这一篇论文很不错,也很有价值;它重新思考了googLeNet的网络结构--Inception architecture,在此基础上提出了新的改进方法; 文章的一个主导目的就是:充分有效地利用compu ...

  4. CVPR 2020 Workshop on Continual learning in Computer Vision 征稿

    点击我爱计算机视觉标星,更快获取CVML新技术 为了进一步推广Lifelong Robotic Vision项目,吸引更多的学术工业界的研究开发人员,英特尔中国研究院作为主办方之一 在IEEE Con ...

  5. 论文投稿指南——计算机视觉 (Computer Vision) 顶会归纳

    深度学习Tricks,第一时间送达 目录 (一)计算机视觉顶会 (1)ICCV:International Conference on Computer Vision (2)CVPR:Internat ...

  6. computer vision(计算机视觉)方面的期刊会议,学术必备

    一.机器视觉方面的顶尖三大国际会议:ICCV, CVPR和ECCV  1.ICCV 全称是International Comference on Computer Vision,每两年举行一次,与EC ...

  7. Resource of computer vision, pattern recognition, machine learning etc.

    Resource of computer vision, pattern recognition, machine learning etc. 1.牛人 Serge Belongie at UC Sa ...

  8. 今天开始学模式识别与机器学习Pattern Recognition and Machine Learning (PRML)书,章节1.2,Probability Theory (上)

    Pattern Recognition and Machine Learning (PRML)书,章节1.2,Probability Theory (上) 这一节是浓缩了整本书关于概率论的精华,突出一 ...

  9. (1)课程简介-CS231A:Computer Vision, From 3D Reconstruction to Recognition

    斯坦福大学-源地址: CS231A: Computer Vision, From 3D Reconstruction to Recognition CS231AGitHub笔记:https://git ...

最新文章

  1. 准备IE--复习NP,NP从头开始,每天学一点,就多一点收获
  2. linux 编写系统服务,Linux shell编写系统服务脚本
  3. 「AI白身境」搞计算机视觉必备的OpenCV入门基础
  4. python 数据分析学什么-学好python和数据分析有什么关系?
  5. 物联网平台构架系列 (四):Amazon, Microsoft, IBM IoT 解决方案导论 之 平台
  6. Cajo,用Java完成分布式计算的最简单方法
  7. 第七节:WebApi与Unity整合进行依赖注入和AOP的实现
  8. CutJS – 用于 HTML5 游戏开发的 2D 渲染引擎
  9. Linux API函数总结
  10. 程序员最应该读的图书
  11. 一个简单的Java Web项目
  12. pku1274 The Perfect Stall
  13. linux livecd 挂载硬盘,网上的Ubuntu LiveCD硬盘安装方法
  14. 春考计算机组装与维护,计算机组装与维护教程(高职高专计算机系列)
  15. python 实现图片转视频
  16. 在就业创业中,您觉得最重要的是什么?
  17. Mysql数据库简单回滚操作
  18. shell 脚本实战 五
  19. 系统迁移必知会(多年总结)
  20. 如何安装SwitchyOmega

热门文章

  1. Matplotlib 多子图绘制
  2. 苹果xr十大隐藏功能_Win10系统中你想象不到的十大隐藏功能
  3. PMOS管经典开关电路-PMOS开关典型电路工作原理及分析-KIA MOS管
  4. WIFI 认证加密模式介绍
  5. 2018第十届中国云计算大会7月即将开幕!
  6. RRDTool (比较全)
  7. APICloud实战--每日生鲜App
  8. 误用rm -rf *文件修复及修改rm指令为mv
  9. 申请优豆云免费虚拟主机使用感受分享心得
  10. final修饰的变量