Cups vs. Glasses: An embedded programme

Author/s: Paul Mair, Sebastian Lang
Posted: 12 June 2020

This is a teachable machine trained to distinguish between cups and glasses. The CUPS vs GLASSES project was made as part of the Introduction to Artificial Intelligence 2 course in the Cross-Disciplinary Strategies Department.

You can here see the result of their teachable machine. We invite you to show the machine the CUP or GLASS nearest to you in order to see if it can, indeed, tell the difference.

Carola Sperger, Liang Wanyuan, Laura Oyuela, Paul Mair and Sebastian Lang decided on the differentiation of cups and glasses given that these objects are of daily-use and can be easily differentiated by humans. But do you think that they may also be distinguished by a computer program? The group gathered all of their cups and glasses and took them to a photoshoot session in order to gather enough images to teach the intelligent machine.

Glass // Source: HAY DESIGN


   In order to drink something, we might use a cup or glass. These are both tools to hold liquid, yet what are the differences between cups and glasses? To us, sometimes it is so obvious that “this is a cup and that is a glass”, but sometimes, we can also get confused by the fusioned shape of a container. Will an AI learning machine get confused like us? How much will it get confused? What will confuse it? What are the differences between its confusion and ours?

Our goal in this project is to make A.I Teachable Machine learn to distinguish between cups and glasses.

A glass-cup // Source: HAY DESIGN

To train the machine, we input some pictures of cups and glasses into the program. In those pictures, there is either one cup or one glass with a whiteboard background. For each category we have about 100 pictures. The shapes, colors, materials and functions are varied. For example, in the category of cup, we have antique porcelain cups for coffee and tea, modern paper cups for Starbuck coffee, cups made of metal for measuring; and in the section of glass, we have tulip-shaped glasses for wine, medium-sized glasses for whisky, water or coca-cola, and tiny glasses for shots.


     When training the program, we simply put in the pictures we have into two separate categories. During the testing process, at the beginning we actually faced some difficulties that the machine couldn’t identify the containers we show very well, whether they are cups or glasses. We realized that it could be that we didn’t put in enough pictures for training, so we collected more pictures and when the number of pictures increased to around 100, the machine could generally distinguish between most of the cups and glass we showed.

During our testing of the machine, we found it funny that sometimes the machine will identify our faces as cups or glasses when there were only faces on the screen. So we set up the third category named “No cups No glasses”, for which we input pictures of faces from many people. In the end, when our faces are shown on the screen, we are finally neither a cup nor a glass. Another challenge for the model were those containers which lay in the “grey area” between cups and glasses, or either not so typical for us, whether it is a cup or glass, for example, a feeder for baby, or a cup with a straw.

Glass cup // Source: HAY DESIGN

After training, most of the time, the classifier worked quite well for our project. However, we also found it funny when we presented it with a cup made from glass, it would classify it as a glass rather than a cup even though this glass cup featured all characteristics of a cup!