Fingerprint detection
来源:互联网 发布:彩虹6号 知乎 编辑:程序博客网 时间:2024/06/05 05:40
1、数据集的构建:将图像转化成相应的格式:01.1.png,01表示假的,1表示图像的编号。由于假指纹spoof中图像的标注是一样,因此需要分别构建10标签,并且图像的递增的顺序是按照1--200, 201--400, 401--600, 601-800的顺序;
http://stackoverflow.com/questions/40994583/how-to-implement-tensorflows-next-batch-for-own-data
import numpy as np
def next_batch(num, data):
"""
Return a total of `num` samples from the array `data`.
"""
idx = np.arange(0, len(data)) # get all possible indexes
np.random.shuffle(idx) # shuffle indexes
idx = idx[0:num] # use only `num` random indexes
data_shuffle = [data[i] for i in idx] # get list of `num` random samples
data_shuffle = np.asarray(data_shuffle) # get back numpy array
return data_shuffle
# demo data, 1d and 2d array
Xtr, Ytr = np.arange(0, 10), np.arange(0, 100).reshape(10, 10)
print(Xtr)
print(Ytr)
print("\n5 randnom samples from 1d array:")
print(next_batch(5, Xtr))
print("5 randnom samples from 2d array:")
print(next_batch(5, Ytr))
import numpy as np
class Dataset:
def __init__(self,data):
self._index_in_epoch = 0
self._epochs_completed = 0
self._data = data
self._num_examples = data.shape[0]
pass
@property
def data(self):
return self._data
def next_batch(self,batch_size,shuffle = True):
start = self._index_in_epoch
if start == 0 and self._epochs_completed == 0:
idx = np.arange(0, self._num_examples) # get all possible indexes
np.random.shuffle(idx) # shuffle indexe
self._data = self.data[idx] # get list of `num` random samples
# go to the next batch
if start + batch_size > self._num_examples:
self._epochs_completed += 1
rest_num_examples = self._num_examples - start
data_rest_part = self.data[start:self._num_examples]
idx0 = np.arange(0, self._num_examples) # get all possible indexes
np.random.shuffle(idx0) # shuffle indexes
self._data = self.data[idx0] # get list of `num` random samples
start = 0
self._index_in_epoch = batch_size - rest_num_examples #avoid the case where the #sample != integar times of batch_size
end = self._index_in_epoch
data_new_part = self._data[start:end]
return np.concatenate((data_rest_part, data_new_part), axis=0)
else:
self._index_in_epoch += batch_size
end = self._index_in_epoch
return self._data[start:end]
dataset = Dataset(np.arange(0, 10))
for i in range(10):
print(dataset.next_batch(5))
- Fingerprint detection
- 【安全牛学习笔记】SQLMAP自动注入-INHECTION、DETECTION、TECHNIQUES、FINGERPRINT
- detection
- New Fingerprint Technology Developed
- MD5 Fingerprint 1.1
- PHP fingerprint实现
- android SHA1 fingerPrint
- Biometric-----Fingerprint Recognition
- 前端应用(fingerprint)
- Android Fingerprint -- Enroll流程
- Fingerprint指纹识别学习
- Fingerprint CtsOsTestCases fail
- Android Fingerprint -- Enroll流程
- 自定义ro.build.fingerprint
- Fingerprint指纹识别学习
- Fingerprint 亮灭屏监听
- Android Fingerprint -- Enroll流程
- fingerprint image segmentation
- 辞职感想
- intent.setFlags方法中的参数值含义
- express笔记--基础
- centos下vim使用
- STM32:ADC采集数据实例(采用DMA模式)
- Fingerprint detection
- C++第5次实验(提高班)—类和对象1 :三、项目名称:Book类
- MySQL中的子查询
- 布隆过滤器
- Nginx服务器的缓存机制
- iOS YYModel使用方法
- 使创建的普通用户具有root权限
- Linux Centos7.3 开机启动 Nginx服务
- CF 实力二分