人生总会有迷茫,会有不知道哪里错了,会有一种说不出的心情。这是一种美妙的感觉,但也可能会让人非常不舒服。在过去的一年里,我一直在想我能做什么,我能做什么,如果我没有工作会发生什么。我还剩下什么?
[En]
Life will always be confused, there will be do not know what is wrong, there will be a kind of unspeakable mood. It's a wonderful feeling, but it can be very uncomfortable. Over the past year, I have been thinking about what I can do, what I can do, and what will happen if I don't have a job. What do I have left?
今年,我的粉丝第一次突破5000,我很高兴,工作之后的乐趣,就是写写文章,写写代码。让更多的人能了解到编程的乐趣,也是一件不错的事情。
我的更新频率不是那么准时,也不是很频繁。同时,这也让我怀疑自己。我的文章是否有意义,我是否能帮助你。我的方向是什么?
[En]
The frequency of my updates is not that punctual, nor is it very frequent. At the same time, it also makes me doubt myself. Whether my writing is meaningful, whether I can help you. What is my direction?
然后就在这种不断的自我内耗中,感觉整个人越来越坏。
一次翻看短视频的机会,我被点醒了,那句话让 我印象深刻:成功,不成功,失败,不失败,你总是患得患失,太在意昨天,又太担心将来,昨天已经成为历史,将来是一个谜团,今天,是上天赐给我们的礼物,像珍惜礼物哪样珍惜今天。
是的,这么简单的道理,只有亲身经历,才能知道,即使是一些简单的道理,也还在不断循环,不如珍惜当下,活好每一天,面对这么多可爱的人和可爱的事。给生活增添一点乐趣。
[En]
Yes, such a simple truth, only through personal experience, can we know that even some simple truths are still in a constant cycle, so it is better to cherish the present, live every day, and face so many lovely people and lovely things. Add a little fun to life.
今天,我给了我的粉丝一张照片,这张照片是由所有粉丝的头像组成的。感谢您的关注,您让我拥有了创作的热情,在未来,我们也会在一起。
[En]
Today, I gave my fans a picture, which is made up of the avatars of all the fans. Thank you for your attention, you let me have the enthusiasm of creation, in the future, we will also be together.
第一步:获取粉丝列表头像
import requests
import os
def get_fs_img(page,id):
"""获取图片链接,名称"""
headers = {
'Accept':'application/json, text/plain, */*',
'Accept-Encoding':'gzip, deflate, br',
'Accept-Language':'zh-CN,zh;q=0.9',
'Connection':'keep-alive',
'Host':'blog.csdn.net',
'Origin':'https://djyqxbc-python.blog.csdn.net',
'Referer':'https://djyqxbc-python.blog.csdn.net/?type=sub&subType=fans',
'sec-ch-ua':'" Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"',
'sec-ch-ua-mobile':'?0',
'sec-ch-ua-platform':'"Windows"',
'Sec-Fetch-Dest':'empty',
'Sec-Fetch-Mode':'cors',
'Sec-Fetch-Site':'same-site',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36'
}
reponses=requests.get("https://blog.csdn.net/community/home-api/v2/get-fans-list?page="+str(page)+"&pageSize=500&id="+str(id)+"&noMore=false&blogUsername=qq_39046854",headers=headers)
fs_list=reponses.json()["data"]["list"]
for n,i in enumerate(fs_list):
with open("photos\\"+i["username"]+".jpg","wb") as f:
he={'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36'}
img=requests.get(url=i["userAvatar"],headers=he).content
f.write(img)
if n==499:
print(i["id"],page+1)
page+=1
get_fs_img(page,i["id"])
第二步:清除默认头像数据
数据中有一部分采用默认图像,因此需要去除默认图
def clear_default_img():
"""过滤默认头像"""
for root, dirs, files in os.walk("photos"):
for i in files:
img_path="photos\\"+i
f=open(img_path,"rb")
b = f.read()
for file in ["1.jpg","2.jpg","3.jpg","4.jpg"]:#比对默认图片,进行删除
m = open(file, "rb")
a=m.read()
if a==b:
f.close()
os.remove(img_path)
第三步:生成粉丝图像
from PIL import Image
import numpy
import os
import random
import numexpr
# line_num: 一行放多少张照片
# # col_num: 一列放多少张照片
# # fans_w: 照片宽为多少
# # fans_h: 照片高为多少
line_num =100#一行放多少张照片
col_num = 100#一列放多少张照片
fans_w = 20#照片宽为多少
fans_h = 20#照片高为多少
def uniform_size(file_path, width, height):
"""将照片统一大小"""
img = Image.open(file_path)
if img.mode != "RGBA":img = img.convert("RGBA")
uniform_img = img.resize((width, height))
return numpy.array(uniform_img)[:height, :width]#创建一个数组。
def create_img():
"""创造图片,并保存"""
list_img=[]
path ="photos/"
for i in os.listdir(path):
list_img.append(path + i)
wight = line_num * fans_w
height = col_num * fans_h
expr= numpy.array(uniform_size("icon.jpg", wight, height))#创建一个矩阵,二维数组。
expr = numexpr.evaluate("expr*0.3")#加快运算速度
for i in range(line_num):
for j in range(col_num):
ex = expr[(j * fans_h):((j + 1) * fans_h), (i * fans_w):((i + 1) * fans_w)]
un = uniform_size(random.choice(list_img), fans_w, fans_h)#随机获得一张图片,并控制大小
res = numexpr.evaluate("ex+un*0.7")#加快运算速度
expr[(j * fans_h):((j + 1) * fans_h), (i * fans_w):((i + 1) * fans_w)] = res
Image.fromarray(expr.astype(numpy.uint8)).save("fans_logo.png")
if __name__ == "__main__":
create_img()
Original: https://blog.csdn.net/qq_39046854/article/details/122461820
Author: 大家一起学编程(python)
Title: 【爬虫 3】送给所有粉丝的新年礼物--粉丝画像

如何进行模型的部署和优化

JanusGraph:在Gremlin控制台中切换图,新建图

单阶段多人 2D 人体估计算法——KAPAO

.pb文件转换为tflite文件遇到问题汇总
![文件夹(?)[+]](https://www.itcode1024.com/wp-content/themes/begin/prune.php?src=https://www.itcode1024.com/wp-content/themes/begin/img/loading.png&w=280&h=210&a=&zc=1)
文件夹(?)[+]

ubuntu18.04 基于keras和tf的yolo4测试问题

离线语音风扇设计应用案例

元宇宙里的手势交互(三)地表最强的手势交互原理剖析(HoloLens 2)【下】

树莓派首次开机远程配置网络

CCF推荐—计算机图形学与多媒体 / 人工智能 两大板块计算机视觉、人工智能、图形学等方向所有会议deadline(以2022年为例)

Win10环境下TensorFlow缺失moviepy模块的安装解决

Paper Reading – 基础系列 – Rethinking ImageNet Pre-training

懒出天际–语音鼠标,解放双手,靠嘴使唤鼠标。SAPI语音识别,WINAPI鼠标消息

Introducing TensorFlow Graph Neural Networks
