These are two “sister” lab assignments. The first one involves “old school” computer vision techniques to segment and classify LEGO pieces. However, the images’ background is relatively simple. The second lab assignment provides the students with a larger public dataset with LEGO pieces with more challenging backgrounds. They need to use deep learning techniques to count the LEGO pieces. The first assignment is given to students during week four of a sixteen-week course. The second assignment is given on week eight.


Computer vision (object detection, thresholding, edge detection).


Undergraduate or graduate course in computer vision.


As described in the summary, this assignment consists of two labs. I expect each lab will take our students two weeks to complete (assuming they spend 10 hours per week). Students have found this timeline fair.


Even though the outcome is clearly identified, students have lots of freedom on how to solve the challenge. There are some techniques suggested but it is up to the students to decide which approaches to use. They are also encouraged to do some image preprocessing and there are many ways to do this.

By solving the first lab, students gain confidence and are ready for the second lab, which offers a more complex and large dataset.


The second dataset is very large and a deep convolutional network has to be trained. This requires a large amount of computational power. There are free resources like Google Colab that will take care of the computations. Nevertheless, students with access to GPUs will have an advantage.


Students need to be familiar with basic computer vision techniques (e.g., image thresholding, edge detection) as well as deep learning (mainly convolutional neural networks). Access to a GPU is required. The best way to get access to a GPU is to use Google Colab or any other free service that runs the computations in the cloud instead of inside the student's computer. Most students work in Python but they can use any programming language of their choice. When using Python, students also use computer vision / machine learning frameworks such as OpenCV, PyTorch, TensorFlow.


The assignment features two labs: the first one relies on "old school" computer vision techniques. The second one relies on deep learning techniques. Instructors could only assign one of the labs if they want to. Additionally, creating the dataset can be part of the assignment: each student could be asked to capture and label 20 images featuring LEGO pieces. Of course, they do not have to be LEGO pieces; we could build any dataset with common objects such as marbles, pens, cups, etc.