Python有趣|微博网红大比拼 !

AudioCompare:比较音频文件的相似性 概括 比较两个音频文件或音频文件目录以评估它们的相似性。 可能已从另一个文件派生的文件被标记为匹配。 要运行该程序,请输入以下之一: ./audiocompare -f文件1 -f文件2 ./audiocompare -f文件1 -d目录1 ./audiocompare -d目录1 -f文件1 ./audiocompare -d目录1 -d目录2 “ -f”参数后面的参数必须是文件名,“-d”参数后面的参数必须是仅包含音频文件的目录。 输入文件必须是WAVE或MP3文件。 您可以列出相同的文件或目录两次。 如果发现错误,将打印适当的错误消息,并且程序可以继续执行。 如果比较了两个不匹配的文件,则匹配结果将打印为“ NO MATCH”,如果比较了两个匹配的文件,则显示为“ MATCH ...”,列出两个匹配的文件,并给出匹配分数。 该程序旨在在Linux上运行。 与OS X或 立即下载

前言

在之前的分享中,我们已经学会了简书和知乎小姐姐的爬虫。今天罗罗攀把魔爪伸向了微博网红们,我们找找谁是最美网红。今天的流程如下:

 

 

 

 

网页分析

这里的微博网红链接:https://weibo.com/a/hot/7549094253303809_1.html,这个是微博关注中的新鲜事(大家不需要了解太多,就这个url即可)。里面收集了近段时间的热门网红微博。

 

 

 

Python学习交流群:1004391443

这个网页简单,我们直接使用lxml库来解析即可。这里就强调一点,这个图片是普清的,进入详细页面可以是高清图片,但我发现只需要将图片的url中的“thumb180”换成“mw690”就可以将图换成高清。例如:

https
:
//ww4.sinaimg.cn/thumb180/6960aeaaly1g23wtlad3sj21sc2dsu0x.jpg
https
:
//ww4.sinaimg.cn/mw690/6960aeaaly1g23wtlad3sj21sc2dsu0x.jpg

爬虫代码

根据上面的思路,我们编写爬虫代码:

import
 requests
from
 lxml 
import
 etree
import
 re
headers 
=
 
{
    
'cookie'
:
''
}
url 
=
 
'https://weibo.com/a/hot/7549094253303809_1.html'
res 
=
 requests
.
get
(
url
,
headers
=
headers
)
html 
=
 etree
.
HTML
(
res
.
text
)
infos 
=
 html
.
xpath
(
'//div[@class="UG_list_a"]'
)
for
 info 
in
 infos
:
    name 
=
 info
.
xpath
(
'div[2]/a[2]/span/text()'
)[
0
]
    content 
=
  info
.
xpath
(
'h3/text()'
)[
0
].
strip
()
    imgs 
=
 info
.
xpath
(
'div[@class="list_nod clearfix"]/div/img/@src'
)
    
print
(
name
,
content
)
    i 
=
 
1
    
for
 img 
in
 imgs
:
        href 
=
 
'https:'
 
+
 img
.
replace
(
'thumb180'
,
'mw690'
)
        
print
(
href
)
        res_1 
=
 requests
.
get
(
href
,
headers
=
headers
)
        fp 
=
 open
(
'row_img/'
 
+
 name 
+
 
'+'
 
+
 content 
+
 
'+'
 
+
 str
(
i
)
 
+
 
'.jpg'
,
'wb'
)
        fp
.
write
(
res_1
.
content
)
        i 
=
 i 
+
 
1

记得换上自己的cookie后就可以直接使用啦~

 

 

 

 

人脸识别API

之前我们就讲解过了人脸识别API的使用,这里把在讲解一遍。

首先,打开网址(http://ai.baidu.com/tech/face),登陆后立即使用,我们首先创建一个人脸识别的应用。api的使用说简单很简单(看文档就好了),说难也很难(大家的阅读能力在慢慢下降)。首先,我们看着文档(https://ai.baidu.com/docs#/Face-Detect-V3/top),一步步来。

接着我们通过API Key和Secret Key获取token:

import
 requests
ak 
=
 
''
sk 
=
 
''
host 
=
 
'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={}&client_secret={}'
.
format
(
ak
,
sk
)
res 
=
 requests
.
post
(
host
)
print
(
res
.
text
)

我们拿着token,来请求对应的网页就可以获取图片的内容了。我们拿张超越妹妹的图片做例子~

 

 

 

 

import
 base64
import
 json
token 
=
 
''
def
 get_img_base
(
file
):
    
with
 open
(
file
,
'rb'
)
 
as
 fp
:
        content 
=
 base64
.
b64encode
(
fp
.
read
())
        
return
 content
request_url 
=
 
"https://aip.baidubce.com/rest/2.0/face/v3/detect"
request_url 
=
 request_url 
+
 
"?access_token="
 
+
 token
params
 
=
 
{
    
'image'
:
get_img_base
(
'test.jpg'
),
    
'image_type'
:
'BASE64'
,
    
'face_field'
:
'age,beauty,gender'
}
res 
=
 requests
.
post
(
request_url
,
data
=
params
)
result 
=
 res
.
text
json_result 
=
 json
.
loads
(
result
)
code 
=
 json_result
[
'error_code'
]
gender 
=
 json_result
[
'result'
][
'face_list'
][
0
][
'gender'
][
'type'
]
beauty 
=
 json_result
[
'result'
][
'face_list'
][
0
][
'beauty'
]
print
(
code
,
gender
,
beauty
)
### result 0 female 76.25

这里的token为前面请求得到的,params的参数中,图片需要base64编码~超越妹妹76.25,还算给力。

综合使用

最后,我们逐一请求我们保存的图片,获取小姐姐图片的分数(这里处理为1-10分),并分别存在不同的文件夹中。

import
 requests
import
 os
import
 base64
import
 json
import
 time
def
 get_img_base
(
file
):
    
with
 open
(
file
,
'rb'
)
 
as
 fp
:
        content 
=
 base64
.
b64encode
(
fp
.
read
())
        
return
 content
file_path 
=
 
'row_img'
list_paths 
=
 os
.
listdir
(
file_path
)
for
 list_path 
in
 list_paths
:
    img_path 
=
 file_path 
+
 
'/'
 
+
 list_path
#     print(img_path)
    token 
=
 
'24.890f5b6340903be0642f9643559aa7a1.2592000.1557979582.282335-15797955'
    request_url 
=
 
"https://aip.baidubce.com/rest/2.0/face/v3/detect"
    request_url 
=
 request_url 
+
 
"?access_token="
 
+
 token
    
params
 
=
 
{
        
'image'
:
get_img_base
(
img_path
),
        
'image_type'
:
'BASE64'
,
        
'face_field'
:
'age,beauty,gender'
    
}
    res 
=
 requests
.
post
(
request_url
,
data
=
params
)
    json_result 
=
 json
.
loads
(
res
.
text
)
    code 
=
 json_result
[
'error_code'
]
    
if
 code 
==
 
222202
:
        
continue
    
try
:
        gender 
=
 json_result
[
'result'
][
'face_list'
][
0
][
'gender'
][
'type'
]
        
if
 gender 
==
 
'male'
:
            
continue
        beauty 
=
 json_result
[
'result'
][
'face_list'
][
0
][
'beauty'
]
        new_beauty 
=
 round
(
beauty
/
10
,
1
)
        
print
(
img_path
,
new_beauty
)
        
if
 new_beauty 
>=
 
8
:
            os
.
rename
(
os
.
path
.
join
(
file_path
,
list_path
),
os
.
path
.
join
(
'8分'
,
str
(
new_beauty
)
 
+
  
'+'
 
+
 list_path
))
        
elif
 new_beauty 
>=
 
7
:
            os
.
rename
(
os
.
path
.
join
(
file_path
,
list_path
),
os
.
path
.
join
(
'7分'
,
str
(
new_beauty
)
 
+
  
'+'
 
+
 list_path
))
        
elif
 new_beauty 
>=
 
6
:
            os
.
rename
(
os
.
path
.
join
(
file_path
,
list_path
),
os
.
path
.
join
(
'6分'
,
str
(
new_beauty
)
 
+
  
'+'
 
+
 list_path
))
        
elif
 new_beauty 
>=
 
5
:
            os
.
rename
(
os
.
path
.
join
(
file_path
,
list_path
),
os
.
path
.
join
(
'5分'
,
str
(
new_beauty
)
 
+
  
'+'
 
+
 list_path
))
        
else
:
            os
.
rename
(
os
.
path
.
join
(
file_path
,
list_path
),
os
.
path
.
join
(
'其他分'
,
str
(
new_beauty
)
 
+
  
'+'
 
+
 list_path
))
        time
.
sleep
(
1
)
    
except
 
KeyError
:
        
pass
    
except
 
TypeError
:
        
pass

 

 

 

 

好用的host切换工具 windiws版 SwitchHosts 还用的host切换工具 windiws版 SwitchHosts SwitchHosts! 是一个管理、切换多个 hosts 方案的工具。它是一个免费开源软件。 立即下载

相关推荐

host文件修改

可用于修改HOST文件

Python有趣|微博网红大比拼

前言在之前的分享中,我们已经学会了简书和知乎小姐姐的爬虫。今天罗罗攀把魔爪伸向了微博网红们,我们找找谁是最美网红。今天的流程如下:网页分析这里的微博网红链接:https:...

罗罗攀 458

python新浪微博爬虫,爬取微博和用户信息 (源码)

这是新浪微博爬虫,采用python+selenium实现。 免费资源,希望对你有所帮助,虽然是傻瓜式爬虫,但是至少能运行。同时rar中包括源码及爬取的示例。 参考我的文章: http://blog.csdn.net/eastmount/article/details/50720436 [python爬虫] Selenium爬取新浪微博内容及用户信息 http://blog.csdn.net/eastmount/article/details/51231852 [Python爬虫] Selenium爬取新浪微博客户端用户信息、热点话题及评论 (上) 主要爬取内容包括: 新浪微博手机端用户信息和微博信息。 用户信息:包括用户ID、用户名、微博数、粉丝数、关注数等。 微博信息:包括转发或原创、点赞数、转发数、评论数、发布时间、微博内容等。 安装过程: 1.先安装Python环境,作者是Python 2.7.8 2.再安装PIP或者easy_install 3.通过命令pip install selenium安装selenium,它是自动测试、爬虫的工具 4.然后修改代码中的用户名和密码

探索 Pixiv-Host:一款便捷的Pixiv图片本地托管工具

探索 Pixiv-Host:一款便捷的Pixiv图片本地托管工具 去发现同类优质开源项目:https://gitcode.com/ 项目简介 是一个开源项目,旨在帮助用户方便地将 Pixiv 平台上的图像资源托管到自己的服务器上,从而避免了由于网络限制或图片删除而导致的访问问题。通过此项目,您可以自由控制和管理您所喜爱的 Pixiv 图片,同时保持对数据的主权。 技术分析 Pixiv-Host 基...

gitblog_00014的博客 1275

sni:SNI检查

斯尼 SNI检查

【数学模型】灰色关联分析

数学模型-灰色关联分析

suic009的博客 1万+

探秘 Pixiv 主机列表项目:优化访问体验的新利器

探秘 Pixiv 主机列表项目:优化访问体验的新利器 去发现同类优质开源项目:https://gitcode.com/ 本文将向您介绍一个旨在提升 Pixiv 访问速度和稳定性的开源项目:。这个项目通过提供优化的 DNS 解析策略,帮助全球的 Pixiv 用户享受更加流畅的服务。 项目简介 Pixiv 是一个深受二次元爱好者喜爱的在线艺术社区,但其访问速度有时会受到网络环境、地理位置等因素的影响。...

gitblog_00085的博客 1306

Dify 第 4 篇 Dify 示例:数据库执行Agent

本文介绍了如何在Dify平台创建一个能够执行SQL查询的数据库Agent。通过安装并配置"通义千问"和"数据库"两个插件,实现自然语言到SQL语句的转换和执行。关键步骤包括:1)安装插件并配置API Key;2)设置默认数据库连接(建议使用只读账号);3)准备测试数据表结构。该Agent支持通过工具调用查询表结构、转换自然语言为SQL、执行查询并返回结果,同时提供了CSV查询和HTTP API接口功能。文中还提供了MySQL测试数据表的创建脚本和示例数据。

甘蓝的专栏 1179

寒假里的python简单爬虫实践

寒假在家无事可干,翻微博看到了EASY前辈说的一句话 程序员应该在过年期间写一个只为自己的程序 深以为然,于是开始思索我目前的技术力能够为自己写啥东西,未果。 又是在刷微博的时候,发现自己收藏里全是一堆小偶像的图片,为什么在收藏里呢,因为平时实在是懒的一张一张去保存,只能放在收藏中。然而一直放在收藏里显然也不是个事,这时想到,我可以用python写个爬虫,把微博上的图片爬取下来。 ...

Midorii的博客 310

人工智能_大模型095_Web版003_deepseek R1本地安装_私有化部署_支持RAG_调用HTTPAPI做自己的AI应用_安装RagFlow以及使用_---人工智能工作笔记0240

这里的一定要注意,是资源不够用了,可以点击ragflow-server左边的小绿点,查看 结果。注意去把内存改成10G把至少,我这里改成了10G,因为电脑一共就16G,再试试吧.可以看日志,就显示的是没有连接上mysql,结果我一看,mysql,根本没启动.然后下面选择general就可以了,然后点击确定,然后再去点击。手动去启动,然后再去试试,注意,内存这里给8G太小了还是.调成8G了,然后硬盘大了大了一些换成50G了,然后。点击系统模型设置可以看到,选择聊天模型就可以了,

添柴程序猿的专栏 460

工程测量不用愁,120个视频动画帮你忙,简单易学直观明了!

工程测量不用愁,120个视频动画帮你忙,简单易学直观明了!文末提供下载地址。 下载地址: 链接:https://pan.baidu.com/s/11S6XDq9Eaa3DG3VKRMBIPg

智慧空间实验室 1023

修改host

https://www.php.cn/faq/475169.html

qq_44168134的博客 1266

YOLOv13改进策略【损失函数篇】| 2024 引进Focaler-IoU损失函数 加强边界框回归 (Focaler-DIoU、Focaler-GIoU、Focaler-CIoU)

本文记录的是改进YOLOv13的损失函数,将其替换成。现有研究通过利用边界框之间的几何关系来提高回归性能,但忽略了困难样本和简单样本分布对边界框回归的影响。不同检测任务中困难样本和简单样本的分布不同,对于简单样本占主导的检测任务,关注简单样本的边界框回归有助于提高检测性能;对于困难样本比例较高的检测任务,需要关注困难样本的边界框回归。,提高检测器在不同检测任务中的性能。实现的。

Limiiiing的博客 873

美国网红python微博_Python有趣|微博网红大比拼 !

前言在之前的分享中,我们已经学会了简书和知乎小姐姐的爬虫。今天罗罗攀把魔爪伸向了微博网红们,我们找找谁是最美网红。今天的流程如下:网页分析这里的微博网红链接:https://weibo.com/a/hot/7549094253303809_1.html,这个是微博关注中的新鲜事(大家不需要了解太多,就这个url即可)。里面收集了近段时间的热门网红微博。Python学习交流群:1004391443这...

weixin_39968820的博客 194

【推荐100个unity插件】性能极高的逼真爆炸、火焰和烟雾效果——UNI VFX

这是一篇关于Unity中高性能GPU粒子特效插件UNI VFX的使用指南。文章介绍了该插件提供逼真的爆炸、火焰和烟雾效果,支持URP和HDRP渲染管线。主要内容包括:插件安装方法(需预先安装Visual Effect Graph和Shader Graph包)、事件系统使用方法(如create/loop/stop等事件控制)、特效分类(自动结束型和持续型特效)、检视面板配置技巧以及性能优化建议(特别提醒灯光特效对性能的影响较大)。文末还推荐了多个Unity开发相关的专栏内容。

向宇的博客,专注php/web全栈 unity游戏开发,欢迎大家评论纠错 1506

【ODX介绍】-4.2-UDS诊断$27服务在ODX-D诊断描述文件中如何描述

共25页精讲:附ODX-D XML:UDS $27 Security服务0x61和0x62 Sub-Function,其它Sub-Function可参照其格式。 目录 1 ODX-D描述一个UDS $27 Security服务Sub-Function的结构 2 标签DIAG-SERVICE描述的内容 2.1 举例:DIAG-SERVICE的XML描述 3 标签REQUEST描述的内容 3.1 举例:REQUEST的XML描述 4 标签POS-RESPONSE描述的内容 4.1 举例:PO..

「汽车电子助手」的博客 1127

美国网红python微博_Python有趣|微博网红大比拼

原标题:Python有趣|微博网红大比拼 前言在之前的分享中,我们已经学会了简书和知乎小姐姐的爬虫。今天罗罗攀把魔爪伸向了微博网红们,我们找找谁是最美网红。今天的流程如下: 网页分析这里的微博网红链接:https://weibo.com/a/hot/7549094253303809_1.html,这个是微博关注中的新鲜事(大家不需要了解太多,就这个url即可)。里面收集了近段时间的热门网红微博。 ...

weixin_39550937的博客 122

《唤醒你的AI同事:WorkBuddy从零上手》000:介绍及目录

《唤醒你的AI同事:WorkBuddy从零上手》全书导览与总目录:000–043 共 44 篇,覆盖从环境搭建、对话基础到资料库、行业助手与多模态生成的入门实战。含完整篇目速查与编号直达,建议关注收藏。

LuckyHanMo的博客 636

美国网红python微博_Python有趣|微博网红大比拼

前言在之前的分享中,我们已经学会了简书和知乎小姐姐的爬虫。今天罗罗攀把魔爪伸向了微博网红们,我们找找谁是最美网红。今天的流程如下:网页分析这里的微博网红链接:https://weibo.com/a/hot/7549094253303809_1.html,这个是微博关注中的新鲜事(大家不需要了解太多,就这个url即可)。里面收集了近段时间的热门网红微博。Python学习交流群:1004391443这...

weixin_39572794的博客 123

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

3分钟上手!WeiboSpider:零代码搞定微博数据采集,让小白也能轻松获取相关信息、内容、互动数据

WeiboSpider是一款专为微博数据采集设计的强大工具,它能帮助科研人员、商业分析师以及社交网络爱好者轻松获取微博相关信息、内容、粉丝关系等数据,无需复杂的编程知识,让数据采集变得简单高效。 ## 为什么选择WeiboSpider?解决微博数据采集的3大痛点 你是否在为微博数据采集而烦恼?手动复制粘贴效率低下?找不到合适的工具抓取全量信息?担心技术复杂难以上手?WeiboSpider就是你

gitblog_00550的博客 1656

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

微博图片批量下载终极指南:3分钟学会免登录高效采集技巧

还在为手动保存微博图片而烦恼吗?每天花大量时间一张张保存喜欢的微博图片,既耗时又容易出错?今天我要为你介绍一款神器——weiboPicDownloader,这是一款专业的微博图片批量下载工具,让你无需登录微博账号,就能快速批量下载用户相册中的所有图片。这款基于Python开发的开源工具彻底解决了传统手动保存的痛点,是内容创作者、媒体工作者和普通用户的得力助手。 ## 传统方法 vs weiboP

gitblog_00334的博客 183

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

由 Python 开发的几款顶级 App

公众号关注“GitHubDaily”设为 “星标”,带你了解圈内新鲜事!如今 Python 越来越火,大有登顶编程语言榜首的趋势,很多人开始知道或者学习 Python,今天就介绍几款由...

GitHubDaily 1589

Python 数据分析 Matplotlib 绘图库详解

Matplotlib 是一个Python 2D 绘图库,常用于数据可视化。它能够以多种硬拷贝格式和跨平台的交互式环境生成出版物质量的图形。Matplotlib 非常强大,绘制各种各样的图表游刃有余,它将容易的事情变得更容易,困难的事情变得可能。只需几行代码就可以绘制折线图、柱形图、直方图、饼形图、散点图等。数据统计得再好都不如一张图表清晰、直观。

qq_46387472的博客 2520
上一篇: Python音频操作工具PyAudio上手教程!
下一篇: python网页爬虫实战:PEER数据库地震波批量下载 !
普通网友
博客等级 码龄7年 438粉丝 263原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值
⌂ 换网址