自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

~~~

  • 博客(10)
  • 收藏
  • 关注

原创 数据预处理之提取人脸关键点并保存至.csv文件中

经常看到有代码中将数据集中人脸的关键点提取出来,并放在csv文件中,csv中每行存放一张人脸的信息,格式为:image_name,part_0_x,part_0_y,part_1_x,part_1_y,...,part_67_x,part_67_y看到网上一个不错的实现方法,故记录一下。首先是 create_csv.pyimport dlibimport globimp...

2020-04-16 17:22:54 1266

原创 解决读取txt每行字符末尾有'\n'

利用 Python strip() 移除字符串头尾的指定字符注意:头和尾同时会删去,且只能删头或尾,中间不变用法:a = 'abc765488hgvffbda'b = a.strip('a')print(b)# bc765488hgvffbda = 'abc765ab488hgvffbda'b = a.strip('ab')print(b)# c765ab488hgv...

2020-04-16 14:45:42 675

原创 extend和append区别

a = ['dog', 'cat']b = ['cat']a.append(b)# ['dog', 'cat', ['snake']]a.extend(b)# ['dog', 'cat', ['snake'], 'snake']append是将b看作一个object相加extend 是list中的元素相加

2020-03-12 15:22:23 119

原创 return和print的区别

第四课的课堂练习中有一个小例子:def add(x, y): return x+y def mult(x, y): print (x * y)add(1, 2)print(add(1, 2))mult(3, 4)print(mult(3, 4))题目问的是屏幕上会输出几行结果?显然,应该是4行.前三行为数值,最后一行是None.mult这个函数返回None,没有re...

2020-03-11 22:20:23 754

原创 MIT 6.0001 ps2

# Problem Set 2, hangman.py# Name: # Collaborators:# Time spent:# Hangman Game# -----------------------------------# Helper code# You don't need to understand this helper code,# but you will...

2020-03-11 21:56:52 558

原创 MIT 6.0001 ps1 c

bisection search有递归,无递归两种写法def achieve_down_payment(num, annual_salary, portion_down_payment): current_savings = 0 month =1 while ((current_savings - portion_down_payment) < (-100)):...

2020-03-06 21:07:15 358

原创 MIT 6.0001 ps1 b

import mathannual_salary = int(input('Enter your annual salary:'))portion_salary = float(input('Enter the percent of your salary to save, as a decimal:'))total_cost = int(input('Enter the cost of y...

2020-03-06 17:12:28 224

原创 MIT 6.0001 ps1 a

# House Hunting# total_cost: the cost of your dream home# portion_down_payment: 预付款 assume 0.25# current_savings: start with 0# r: annual return of investment current_savings*r/12# annual_salar...

2020-03-06 16:20:44 202

原创 MIT 6.0001 ps0

Assignment:Write a program that does the following in order:Asks the user to enter a number “x”Asks the user to enter a number “y”Prints out number “x”, raised to the power “y”.Prints out the lo...

2020-03-04 14:28:44 184

原创 Python 处理数据集,合并多个文件/随机划分为train/valid/test

对某个数据集进行处理,使之符合我的需要。import osimport shutilimport random# from xxx_dataset randomly choose images # to make a new data# 60% train # 20% valid# 20% testpath = '/remote-home/my/Databas...

2020-02-19 23:46:41 2000

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除