Search within Lanny's blog:


Leave me comments so I know people are actually reading my blogs! Thanks!

Saturday, March 21, 2009

Machine Learning and Chicken Fighting

When chickens attack, we have AI
(photo credit: Olena Istomina/iStockphoto)
Does machine learning have anything to do with chicken fighting? Turned out they could certainly be related according to this article I ran across at IEEE Spectrum.

A casual lunch conversation between robotics engineer Stephen Roberts and animal welfare specialist Marian Dawkins sparked an idea of using pattern-recognition technology to help identify misbehaving hens.

Chicken fighting is a difficult and costly problem for poultry farmers. Deprived of space to forage and peck (birds have the instinct to peck the ground in search of food), chickens are likely to peck at other things, like one another, and sometimes to death. A couple of tense chickens might evolve into an all out fight. But if a farmer can identify these stressed-out chickens early, the problem can be reduced. However, trained experts cannot watch the flocks constantly.

Stephen has been researching on human crowd movement using using a machine-vision system based on optical flow -- a technique that measures how the pixels "flow" from one frame to another frame in a video in order to identify object movements. When this technology is applied to chicken monitoring, especially on observing how they walk, it worked great -- after processing footage of more than 300000 commercial free-range chickens, the machine predicted troublemakers matched the flocks that had the most feather damage.

Here's an example video of the optical flow technique.

In order for machine learning algorithms to work with such a problem, the designer must first select features to track. A feature could be the average value of a group of pixels, or a moving pattern. Depending on the machine learning algorithm used, the number of features can span a large range (because some algorithms are smart enough to pick the "better" features to use). Chicken exports then label each data record (one footage of a chick walking) in the training set (say a few hundred records) identifying whether it was a stressed-out chick or not. The machine learning algorithm is then ran against the training set, maybe evaluate its own performance and try to improve against a held out set. The learning result is like a dividing surface in a multi-dimensional space (for example, a line divides a plane or a plane divides a 3D space), and points landing on one side of the dividing surface indicate troublesome chickens while points on the other side of the dividing surface show well-behaved chickens. Stephen had used Hidden Markov Chains (HMC) in his machine learning algorithm according to the IEEE article.

The biggest benefit of this approach is that a computer can take on the laborious constant monitoring work in place of human and only warn farmers when suspecting chickens are identified. Even if there is a good amount of false-positives, the human workload can still be dramatically reduced.

I am very glad to see another real application of AI techniques. Just one more thought: would the chickens behave better if we played ambient music to them all the time?

Video of the Day:

The biggest water balloon fight recorded in human history (4000+ people) right here at BYU in July 2010 during the shooting of Kyle Andrews' official music video "You Always Make Me Smile."

Friday, March 20, 2009

iPad -- a new tool to help treat autism?

Leo has plenty of toys, including this circular balance
beam, but nothing tops the iPad. (Photo by Kelly Nicolaisen)
iPad is probably the most popular high-tech toy on the market right now. But can it be more than just a toy and be useful in other ways, such as helping treat children with autism? The answer is a definite yes.

You might wonder why I am all of a sudden interested in the subject of treating children with autism. Actually, I have been a member of the TiLAR research group working on using assistive robotics technology to help treat children with autism. TiLAR stands for Therapist-in-the-Loop Assistive Robotics.

Recently, I came across an article named iHelp for Autism from SF Weekly. The article told multiple stories of how an iPad helped improve the behaviors of Leo, a 9-year-old artistic child, the son of Shannon Rosa. Shannon had won the iPad from a school raffle, and in the following months, she was pleasantly surprised again and again by how the iPad changed Leo's life and her own, to a better effect, that's of course.

It is important to note that the word autism could mean a spectrum of psychological conditions, that's why the more formal name Autism Spectrum Disorders (ASD) is frequently used. Despite the wide spectrum, autistic children display common symptoms of deficiency in social interactions and communication and severely restricted interests and highly repetitive behavior.

So what are the benefits of using an iPad? Here I'll list some just off the top of my head:
  • It looks slick and cool (remember it won't be like that forever).
  • It's really a platform, so you can run all kinds of things on it like songs, movies, games, maps, etc.
  • You can select things, move things, draw things with your fingers -- a multitouch interface -- and you have plenty of space to do it (unlike an iPhone). The interface is also relatively simple and intuitive, so it doesn't take a lot of time to learn or explore.
  • It's relatively lightweight and is battery powered, so you can carry it with you everywhere you go.
Of course an iPad also has disadvantages:
  • It's expensive.
  • It's fragile (especially the screen).
  • Battery life is not great.
  • Apps have to be approved by Apple (but there's always iPad like devices running Android).
Now when we give an iPad to an autistic child, what could be good?
  • Because an iPad is a fashionable item (at least for now), it would encourage the child to participate in more social activities while holding an iPad -- confirmed by a study.
  • The intuitive and simple finger-controlled interface is attractive to autistic children because they can easily identify things and things are predictable. The finger touch interface is also great to encourage the autistic children to practice manipulate things with their fingers, improving motor skills that are normally problematic for autistic children.
  • Because an iPad can run many games and apps, autistic children are more prone to play educational games on an iPad, so there's more opportunity to learn while feeling good about it.
  • The portability of iPad allows the child to use it anywhere the child wants, and movie playing capability can let the child watch instructional demonstrations -- termed Video Modeling -- frequently and in various locations.
  • An iPad can also act as a communication tool. For example, an autistic girl used an iPad to tell her mother where she'd like to go shopping.
So what could go wrong when we give iPad to an autistic child?
  • One bad tantrum, there goes the screen, and it's expensive!
  • If the child is over-reliant on the iPad as a communication tool, once the battery is dead, the child might go berserk.
As I mentioned earlier, autistic children tend to behave differently from social norms and have problems communicating with others. It seems that we ought to look at three different dimensions when we think about treatment. The first dimension is deviation from social norms. The child can behave more like social norms after treatment or deviate further away. The second dimension is the ability to communicate. A treatment might help the child to communicate better or make it worse. The third dimension is the ease for caregiver. A treatment can change the child's behavior so it's easier for the caregiver to take care of the child. It might also make the care-giving more demanding/challenging.

Ideally, we'd like the treatment to move the child positively on all three dimensions, but that might not always be true depending on the kind of treatment we provide and the kind of tool we use. Some people might also want to settle at different spots in this three-dimensional space. They'd accept a solution that improves the child's ability to communicate and makes the caregiver's life easier while the child's behavior might deviate further away from social norms. Therefore, one important question to ask is: Where in the 3D chart do you want the autistic child to be? For example, if an autistic child always uses the iPad to tell you what he wants, is that what you want? If the answer is no, then the iPad might actually have done harm instead of good.

Are there other creative ways of using an iPad to help support treating children with autism? The article mentioned that some researchers are actually using iPad to help collect physiological data of the autistic child on-the-go and maybe play a soothing sound/music if they get tense. I'll throw out some ideas of my own just for brainstorming purposes. If you can think of any, feel free to tell me in the comments section.
  • Since we use a robot to assist the therapist in clinic sessions, the iPad can be used by the therapist before the session to program robot behaviors.
  • We can put a virtual character in the iPad to encourage the child to imitate the character's moves. The virtual character can also encourage the child for certain behaviors such as turn taking with the therapist and the robot. The therapist can act as the sensor and use wireless devices to "inform" the virtual character if the child has performed the desired behavior.
  • Maybe let the child use the iPad to choose what games to play with the robot and/or the therapist?
  • The child can also use the iPad to tell the robot what to do (different sequences of moves). Later the child will be required to not only choose buttons on the iPad, but also speak out the request, for the robot to actually perform the moves. Either the robot will try to recognize the speech, or the therapist can be the sensor/processor and issue the approval command instead.
  • The robot might also touch the iPad to do things. We just have to make sure the robot doesn't damage the delicate screen.


Picture of the Day:

TiLAR research group's robot Troy in the middle of a clinical
session with a therapist and a kid.

Thursday, March 19, 2009

Chess Playing Robots at the AAAI-10

Many people are probably aware of the world-famous chess match between Garry Kasparov, a world champion, and Deep Blue, a super computer built by IBM, that took place in 1997. Deep blue won the match, but only with the help of humans because it couldn't really move the chess pieces without an arm. That is no longer the case, especially at the Small Scale Manipulation Competition held at the 24th AAAI (Association for the Advancement of Artificial Intelligence) conference at Atlanta in July 2010, where four robots from different universities paired up against each other and moved all the chess pieces themselves. "Small Scale" here means robots that are smaller than the size of a human, and the goal was not to beat the opponent in a game of chess, but to manipulate chess pieces adeptly and accurately. Extra points can be earned by showing the ability to recognize the pieces on the fly. The competition was one of the many great treats at the conference. As a conference attendee, I was fortunate enough to observe the real duels with my own eyes.

Gambit -- University of Washington Intel Lab
"Gambit" is a robotic arm built by the University of Washington Intel Lab using funding from Intel, and interestingly, one of the two main builders of the robot is actually an old acquaintance I had met at the HRI conference earlier this year in Japan. Her name is Cynthia, and with this connection, I was able to dig out quite some information about how the robot works. Gambit is equipped with both a depth camera and a regular video camera. It uses SIFT features for recognizing pieces on the board and also uses dead reckoning to remember the positions of them. The robot is even smart enough to line up the opponent's pieces it had captured neatly by the side of the board. The gripper has tactile sensors built-in, but according to Cynthia, they aren't very useful, and she had to spend a good amount of time picking the right kind of material for the gripper so it can grab onto a chess piece firmly. One special trick the robot has is the ability to call for help whenever it gets stuck or couldn't reach certain positions. The cost of the robotic arm is relatively cheap (a few thousand dollars) and the university is actually promoting it as a research platform to other researchers.


Chiara -- Carnegie Mellon University Tekkostsu Lab
The strange scorpion look alike robot on the right is "Chiara", a robot built by the Carnegie Mellon University Tekkostsu Lab. It is also an open-source hardware/software platform promoted by the lab priced around several thousand dollars. Before making a move, Chiara would first walk to align itself at the right location, then raise itself high and use its gripper-stinger to pick up the right chess piece. The mobility of the robot seemed really cool, and I thought it was needed because otherwise the robot wouldn't be able to reach pieces at the other half of the board. Turned out, the mobility was only there because it was part of the platform. The robot is actually only able to play half of the board. But because the competition only focused on the first ten moves of each robot, they were able to get away with the limitation. This robot is a vision-only robot, meaning it doesn't use ranger sensors such as infrared, sonar, or laser. Due to the special pattern of the chess board, recognizing the board is not a very difficult task, and the robot performed relatively well during the competition.


Georgia Tech's robot is a massive, expensive looking arm. I would have guessed the price range of the robot to be somewhere around $100K. A Swissranger depth camera was held above the chess board (from a tripod by the side) separately from the robot in order to read the board and chess pieces positions. Ironically, in the first move of the game, the arm misbehaved and made a big swing to the side, almost knocking over the camera-holding tripod. That totally messed up the camera calibration, and the Georgia Tech team got heavily penalized by the judges because they had to reposition the camera and recalibrate everything in order for the robot to work correctly.



The robot built by University of Alabama is definitely the champion with respect to cost. The designer of the robot proudly told me that the entire robot cost less than $700. It uses an iRobot create robot platform as the mobile base. Then a hobby robotics arm kit is used for the arm (our lab has a robotic arm very similar to this that cost around $400). An android phone with a built-in video camera is held above the chess board in order to recognize the board and pieces. Then a Netbook running Ubuntu is used to control and process data from each of those three parts separately through a wireless network. This robot is also a mobile one. It moves around the table in order to align itself to the necessary positions. In the first game though, the members of the team got quite frustrated because it would take forever for the Netbook to download data, which was not the case during the testing in previous day. Turned out they were using the conference shared wi-fi network, which became quite congested at the time of the competition and slowed everything to a crawl. In the second day of the competition, they used their own wireless network, and the situation was improved dramatically.

Each robot played against all the other robots, and the total points were tallied to identify a winner. Eventually, Gambit from University of Washington won the championship with flying colors (or is it really flying arms). The video below was made by the winning team in celebration of their triumph. VERY INTERESTINGLY, part of me and my voice were captured in this video as well, proving that I was actually there!! So here's your challenge of the day: see if you can find me in the video! The video also showed a match between a kid (rumored to be a world-ranked player) and Gambit toward the end, but I don't know who actually won.

Gambit's journey to Championship

In each and every AAAI conference (at least for the last few years), there's always a robot competition and the competition is always great fun! I am so looking forward to next year's competition. Now I just have to write a good paper before the submission deadline and hope it gets accepted....

Picture of the Day:

Beautiful night landscape of Atlanta (taken from the 56th floor of the Peachtree Plaza Hotel in downtown)

Wednesday, March 18, 2009

Set Phasers on Stun -- Bad Designs Kill

Following my adviser's recommendation, I finally picked up the book Set Phasers on Stun by Steve Casey and read it with utter interest. The book is really light reading, but as I read on, my heart felt heavier and heavier.

The book contains 20 short, true stories of how design errors in various technologies led to terrible disasters, often resulting in the loss of many lives. Among them were the shut off handle on a command module capsule that caused the death of three Russian astronauts because it takes too long to turn, the control lever for autopilot vs. manual control caused a supertanker to hit a rock and leaking millions gallons of oil into the ocean because the captain slipped it into an unintended third control mode in panic, the Airbus A320 plane that crashed in an air show demo, killing many passengers, because the pilot was over-confident with the plane's autopilot, and a ferry ship that capsized because the captain didn't know the bow cargo doors were not closed when the ship set off. The key message the author tries to get across is that designers of technology MUST take into consideration human factors, especially possible human errors and capability limitations in tense and nervous situations. Learning from mistakes might be too costly because Bad Designs Kill.

The title of the book comes from the name of the first story in the collection. On March 23, 1986, Ray Cox, a patient in his 30s undergoing treatment to have a tumor removed from his back, was taking his ninth regular treatment with the Therac 25 machine. The Therac 25 is a highly sophisticated machine that's capable of using high-energy radiation to hit cancer cells to any point on or in a person's body with pinpoint accuracy. The machine can operate in two modes: the high-power "x-ray" mode and the lower-power "electron beam" mode. What Ray was to receive would be the lower-power "electron beam" mode. He would not feel a thing. When Mary Beth, the radiotherapy technician, started the procedure in the control room (a different room), she mistakenly typed "x", the command to use the "x-ray" mode. Noticing her mistake, she quickly moved the cursor back and used the "edit" function to change it to command "e", the command to use the "electron beam" mode. She had no idea that her quick sequence of keystrokes within 8 seconds was something the machine had never been run under before. The machine retracted the think metal plate used during "x-ray" mode but left the power setting on maximum. When Mary entered the command to initiate the treatment, Ray saw a blue flash and felt as if he was hit by a lighting bolt. Back in the control room, a message popped up on the monitor with the error message, "Malfunction 54, treatment not initiated." Feeling quite puzzled, Mary re-entered the command to initiate the treatment. Ray was rolling and screaming in pain when he was struck the second time, and he began to call out loud for help. Soon the third shock struck, and Ray jumped from the table and ran to the door. Nobody at the hospital knew what was going on, and only after the same incident happened again to another patient did they realize something was seriously wrong with the machine. Instead of receiving 200 rads of radiation, Ray was shot with 25000 rads. In the next few months, tissues hit by the beams died, leaving massive lesions in Ray's upper body. "Captain Kirk forgot to put the machine on stun," said Ray Cox, trying to keep his humor. Four months later, Ray Cox died.

At least three things went terribly wrong in this tragic incident:
  1. The unexpected key sequence within the short time window should not have allowed the power setting to be left on maximum. The kind of operating mistake Mary made is typical human error and should have been expected and tested against.
  2. The error message should have been clearer, at least warning the operator that something had been seriously wrong (whether it is serious or not) and that the beams have already been shot. This would have prevented Mary from firing the beams again and again.
  3. A strict procedure should have been in place to make sure the patient undergoing treatment is been monitored real-time. This would also have spared Ray from the additional two shots (whether or not it might make a different of life and death in Ray's case).
Here's an article from People covering this story.

As a researcher in AI and robotics, it is likely that I'll be designing advanced and complex systems to be used in real applications. While enjoying the thrill and fun of designing cool toys, it is also very important to always keep in mind the responsibilities we hold. Especially in the case of people working with automation. We should always take into consideration the kind of errors human might make and design accordingly to handle such situations accordingly. As automation and robots emerge in many aspects of people's lives (I am talking about more direct interactions here, not the kind of secluded factory settings), we have to be utterly careful and make sure people don't get injured or killed.

UAV used in our field trial
I couldn't help but remember an incident happened during one of our UAV field trials. Our research group works on using Unmanned Aerial Vehicles to support Wilderness Search and Rescue operations. Once we performed a field trial at Squaw Peak, Provo, Utah, a very mountainous area. The UAV is capable of maintaining a fixed height above ground, so to relieve some of the workload off the operator. The control software also overlays the area with a color map, warning the operator if the UAV is too close to the side of the mountain. When the UAV was flying along the side of the mountain, the operator noticed from the color warning that the UAV was too close to the side of the mountain, so he commanded the UAV to fly away from the mountain. Then the autonomy of maintaining fixed height above ground kicked in and the UAV quickly descended. The operator noticed that the UAV is still too close to the side of the mountain and kept "pushing" the UAV away from the mountain. Eventually the UAV lost control and crashed to the ground because it had been descending quickly continuously and failed to climb up fast enough when it ran into a small hill. Both capabilities were supposed to help the human better fly the UAV, but the combination in the specific situation actually directly led to human error and the plane crash (luckily the plane was not badly damaged).
Squaw Peak, Provo, Utah
So what should we do? There's obviously the need for extensive testing. The designer should also consider possible human errors and design accordingly to minimize the chances of human errors and deal with human errors when they do occur. Especially if the failure of the system might create catastrophic consequences, extensive safety checks must be built in. We'd rather for a machine to fail than for it to kill. Then, there's always the possibility of insurance polices as the last resort, as shown in today's Video of the Day.

Video of the Day:

For only $4 a month, you can achieve peace of mind in a world full of crime and robots, with Old Glory Insurance!

Tuesday, March 17, 2009

Smiling Proud Wanderer: Chapter 21 (5)

Read the first 20 chapters here!


Linghu Chong was lying in bed. He quickly turned around with his face toward the inside of the cell. Then he heard Mr. Black-White stopping outside of the prison door and spoke apologetically.
“Revered…revered mister Ren! I am truly very sorry for not having come sooner! In the past month, my eldest sworn-brother never set foot outside. Every day I anxiously awaited the opportunity to come and pay the revered mister my respect, but that opportunity only presented itself today. I hope the revered mister…the revered mister do not take any offense!”
Together with Mr. Black-White’s voice, a wonderful aroma of wine and roast chicken also came in through the square-shaped opening on the prison door. It had been many days since Linghu Chong last tasted any drop of wine. As soon the smell of the wine hit his nose, he could no longer hold his patience and quickly turned around.
“Give me the wine and chicken!” he demanded.
“Sure! Sure! So the revered mister has agreed to teach me the secret formulas of the divine art?” Mr. Black-White asked.
“Bring me three catties[1] of wine and a whole chicken each time, and I’ll teach you four segments of the secret formulas. Once I’ve had three thousand catties of wine and one thousand whole chickens, you can probably get all the formulas by then.”
“I am afraid this arrangement might be too slow and cause unnecessary problems. How about I bring six catties of wine and two whole chickens each time so the revered mister can teach me eight segments of the secret formulas?” Mr. Black-White bargained.
“You are certainly greedy!” Linghu Chong said with a grin. “Fine! Come on! Give those to me!”
Mr. Black-White handed over a wooden tray through the square-shaped opening, upon which were a large kettle of wine and a fat roast chicken.
Linghu Chong thought, “I am sure you won’t kill me with poison before I teach you the secret formulas.” So he picked up the wine kettle and quickly gulped down mouthful of wine. The wine was not in any way spectacular, but in his mind it tasted so nice that even Mr. Paint’s Turfan Grape-Wine of four cycles of distillation and ferments was no match for it. Without any stop for breath, he quickly poured half kettle of wine down his throat, and then tore a chicken leg off and shoved it into his mouth. Not very long after, he had already emptied the wine kettle and picked the chicken clean. Giving a satisfied pat to his belly, he declared approvingly.
“Excellent wine! Excellent wine!”
Mr. Black-White let out a big smile. “Now that the revered mister has enjoyed the tasty chicken and great wine, will the revered mister start the teaching please?”
Linghu Chong noticed that Mr. Black-White no longer mentioned anything with regard to the proposed Master-Apprentice relationship and ceremony. “He probably thought I was too busy drinking wine and eating chicken, and I’d completely forgotten about it,” Linghu Chong thought. So he didn’t mention it either.
“Okay. Here are the four segments. You’d better remember them well. ‘Inside the unique channels and eight passages, there exist inner energy streams. Gather them in your Dan-Tian. Join them in your Dan-Zhong[2].’ Do you understand?”
The original text on the steel plate actually read, “Inner energy streams inside Dan-Tian, disperse them into four limbs. Inner strengths inside Dan-Zhong, dissolve them into the eight passages.” Linghu Chong actually deliberately reversed the meaning in his teaching. When Mr. Black-White heard these, he found them to be just as plain as any ordinary inner energy cultivation methods out there, so he quickly replied.
“I got these four segments. Will the revered mister please teach me the next four segments?”
Linghu Chong thought to himself, “After I made the changes, those four segments sounded quite ordinary. Naturally he wanted something more unique. I must find four peculiar segments to give him a good scare!” So he said, “Since today is the first day, I might as well teach you four more. Remember these: ‘Split Yang-Wei Passage with shock. Shut down Yin-Qiao Passage with clog. Once all Eight Passages are broken, the Divine Art will succeed.
Mr. Black-White was stupefied.
“If…if…one’s unique channel and eight passages are broken, how could he stay alive? These…these four segments are really beyond my understanding!”
“Do you expect just any ordinary person to understand such powerful divine art easily? If so, what would be so unique about it? Of course there are many profound and subtle theories in the divine art so no ordinary person could have understood them,” Linghu Chong said with a snort.
As Mr. Black-White listened on, he became more and more suspicious. The manner of speaking and the phrases the “revered mister” used seemed to be quite different from the Ren-named person he knew. In the first two meetings, Linghu Chong had only spoken very few words and also muffled his voice. This time, since Linghu Chong was quite high in spirit after he drank a good deal of wine, he spoke a lot more. Mr. Black-White was a very scrupulous man and these unusual signs quickly brought suspicion to his mind – the “revered mister” must be making up formulas to make fun of him.
“You said, ‘Once all Eight Passages are broken, the Divine Art will succeed.’ Are the unique channel and eight passages of the revered mister all really broken?” he demanded.
“That’s of course,” Linghu Chong acknowledged.
From the tone of Mr. Black-White’s voice, he could sense suspicion developing and building, and he dared not to speak too much. So he quickly concluded.
“That’s all. Comprehend well and you’ll understand.”
After these words, he set the wine kettle back down on the wooden tray and then handed the tray back through the square-shaped opening. Mr. Black-White reached forward to receive the tray, but all of a sudden, Linghu Chong let out a cry and then fell forward. A loud clank echoed as his forehead banged against the iron door.
“Why!” Mr. Black-White uttered. People in his caliber with extraordinary Kung Fu skills always had very quick reflexes. In no time he had reached his hands forward through the square-shaped opening and grabbed hold of the wooden tray, making sure the wine kettle would not fall and smash on the ground. At that split second, Linghu Chong turned his left hand swiftly and grabbed onto Mr. Black-White’s right wrist.
“Black-White! Do you know who I am?” He grinned.


[1] Catty is a unit of weight used in Southeast Asia, especially a Chinese measure equal to 500 grams (approximately 1.1 pounds).
[2] Dan-Zhong is an acupoint in the middle of one’s chest by the Solar Plexus.


Now support the translator Lanny by following my blog and leaving comments! :)


Video of the Day:

Enjoy these self-claimed Kung Fu Masters' performances. I hope you are not one of them. :)