entropy

Python+Android进行TensorFlow开发

a 夏天 提交于 2020-03-17 01:17:51
某厂面试归来,发现自己落伍了!>>> Tensorflow是Google开源的一套机器学习框架,支持GPU、CPU、Android等多种计算平台。本文将介绍在Tensorflow在Android上的使用。 Android使用Tensorflow框架需要引入两个文件libtensorflow_inference.so、libandroid_tensorflow_inference_java.jar。这两个文件可以使用官方预编译的文件。如果预编译的so不满足要求(比如不支持训练模型中的某些操作符运算),也可以自己通过bazel编译生成这两个文件。 将libandroid_tensorflow_inference_java.jar放在app下的libs目录下,so文件命名为libtensorflow_jni.so放在src/main/jniLibs目录下对应的ABI文件夹下。目录结构如下: Android目录结构 同时在app的build.gradle中的dependencies模块下添加如下配置: dependencies { ... compile files('libs/libandroid_tensorflow_inference_java.jar') ... } 使用tensorflow框架进行机器学习分为四个步骤: 构造神经网络 训练神经网络模型 将训练好的模型输出为pb文件

不认得各种中药材?来看看飞桨开发者的妙招

旧城冷巷雨未停 提交于 2020-03-11 16:17:08
【飞桨开发者说】韩爱庆 北京中医药大学管理学院 副教授 中药是中医临床治疗的主要载体、也是中医药文化最核心的载体,蕴含着大量的科技资源、文化资源、产业资源。据相关报道,我国是全球最大的中药材市场。数据显示,2019年预计我国中成药及饮片市场规模达到6800亿元,未来5年将达到2万亿元,可见中药材庞大的市场价值。由于中药材的真伪、优劣与临床用药的安全有效有直接关联,因此对中药材进行客观、科学的鉴定识别,有利于规范中药材市场,加强质量监控,促进中药材产业的发展。 很多学者对应用客观指标来进行中药材的鉴定识别进行了广泛的研究,相关研究所采用的方法包括近红外光谱、指纹图谱、电子鼻以及化学模式识别,或者采用多方法相结合来开展研究。这些方法的共同特征是需要基于专家经验或先验知识来人工设计或提取特征,前期的特征提取工作量特别大,得到的模型在训练集上准确率虽然高,但在测试集上普遍存在泛化能力差的情况;另外使用这些方法来进行中药识别需要专用设备,便利性较差,应用门槛高,不利于推广应用。因此,开发一款能够自动提取特征,并能够使用通用终端设备进行识别,准确率高,泛化性能好的中药识别系统是行业的迫切需求。 近年来,以深度学习为代表的人工智能技术飞速发展。与以往不同的是,这次人工智能不仅在学术界备受关注,在工业界也备受推崇。以“深度学习”为关键词搜索国家自然科学金委近年资助项目,发现基金委资助和立项的

Calculate the entropy of a list of 2D points in Matlab

半城伤御伤魂 提交于 2020-01-30 11:28:05
问题 I have a list of points in an array like this points = [[1,2];[2,5];[7,1]...[x,y]] The x is between 0 and 1020 and y is between 0 and 1920. How can I calculate the entropy of the points array in Matlab? Many thanks! 回答1: I assume you want to consider each [x,y] point as one data point. Let us define some exemplary data: A = [[1,2];[2,5];[7,1];[1,2]]; First we give equal points equal identifiers, we can do this using [~,~,ic] = unique(A, 'rows'); Then we compute the frequency and with that the

Picture entropy calculation

半世苍凉 提交于 2020-01-16 00:39:28
问题 I've run into some nasty problem with my recorder. Some people are still using it with analog tuners, and analog tuners have a tendency to spit out 'snow' if there is no signal present. The Problem is that when noise is fed into the encoder, it goes completely crazy and first consumes all CPU then ultimately freezes. Since main point od the recorder is to stay up and running no matter what, I have to figure out how to proceed with this, so encoder won't be exposed to the data it can't handle.

High entropy random data creating functions?

ぐ巨炮叔叔 提交于 2019-12-25 08:59:22
问题 Are there functions which produce "infinite" amounts of high entropy data? Moreover, do functions exist which produce the same random data (sequentially) time after time? I kind of know that they exist, but do they have a specific name? Use case examples: Using the function to generate 100 bits of random data. (Great!) But while maintaining high values of entropy. Using the same function to generate 10000 bits of random data. (The first 100 bits generated are the same as the 100 bits of

How can I exhaust /dev/urandom for testing?

六月ゝ 毕业季﹏ 提交于 2019-12-23 17:24:50
问题 I recently had a bug where I didn't properly handle when the entropy on my linux server got too low and a read of /dev/urandom returned less than the number of bytes expected. How can I recreate this with a test? Is there a way to lower the entropy on a system or to reliably empty /dev/urandom? I'd like to be able to have a regression test that will verify my fix. I'm using Ubuntu 12.04. 回答1: According to random(4) man page, read from the /dev/urandom device will not block You should read a

Random 256bit key using SecRandomCopyBytes( ) in iOS

我是研究僧i 提交于 2019-12-23 15:07:59
问题 I have been using UUIDString as an encrption key for the files stored on my iPAD, but the security review done on my app by a third party suggested the following. With the launch of the application, a global database key is generated and stored in the keychain. During generation, the method UUIDString of the class NSUUID provided by the iOS is used. This function generates a random string composed of letters A to F, numbers and hyphens and unnecessarily restricts the key space, resulting in a

CUDA Thrust - Counting matching subarrays

亡梦爱人 提交于 2019-12-23 03:35:15
问题 I'm trying to figure out if it's possible to efficiently calculate the conditional entropy of a set of numbers using CUDA. You can calculate the conditional entropy by dividing an array into windows, then counting the number of matching subarrays/substrings for different lengths. For each subarray length, you calculate the entropy by adding together the matching subarray counts times the log of those counts. Then, whatever you get as the minimum entropy is the conditional entropy. To give a

Incremental entropy computation

断了今生、忘了曾经 提交于 2019-12-22 18:35:09
问题 Let std::vector<int> counts be a vector of positive integers and let N:=counts[0]+...+counts[counts.length()-1] be the the sum of vector components. Setting pi:=counts[i]/N , I compute the entropy using the classic formula H=p0*log2(p0)+...+pn*log2(pn) . The counts vector is changing --- counts are incremented --- and every 200 changes I recompute the entropy. After a quick google and stackoverflow search I couldn't find any method for incremental entropy computation. So the question: Is

What is the meaning of “isolated symbol probabilities of English”

我只是一个虾纸丫 提交于 2019-12-22 12:53:41
问题 In a note I found this phrase: Using isolated symbol probabilities of English language, you can find out the entropy of the language. What is actually meant by "isolated symbol probabilities"? This is related to the entropy of an information source. 回答1: It would be helpful to know where the note came from and what the context is, but even without that I am quite sure this simply means that they use the frequency of individual symbols (e.g. characters) as the basis for entropy, rather than