Midterm 1 (2024)
Assignment Rules and Execution
The first midterm covers the basic pattern recognition
techniques introduced up to Lecture 4. To pass the midterm you should
- perform one (only one) of the assignments described in the following;
- report your results as a Colab notebook or a 10 slide presentation (both versions are equally fine) and upload it here by the (strict) deadline;
You can use library functions to perform the analysis (e.g.
to do the DFT, to perform ncut clustering, etc.) unless explicitly indicated. You can use whatever programming language you like,
but I strongly suggest to use either Python or Matlab for which you have coding
examples. Python will further allow you to deliver your midterm as a Colab notebook, but this is not a requirement (you can deliver a presentation instead).
Your report (irrespectively of whether it is a notebook or a presentation) needs to cover at least the following aspects (different assignments might have different additional requirements):
- A title with the assignment number and
your name
- The full code to run your analysis (for Colabs) or a few slides (for presentations) with code snippets highlighting the key
aspects of your code
- A section reporting results of the analysis and your brief comments on it
- A final section with your personal considerations (fun things, weak aspects, possible ways to enhance the analysis, etc.).
Do not waste time and space to describe the dataset or the
assignment you are solving as we will all be already informed on it.
I do not espect state of the art performance: I am more interested in seeing that you have applied the technique correctly and that you can interpret the results, so do not invest heavy time in superoptimizing your results.
List of Midterm Assignments
Signal processing assignments
Assignment 1
Consider the following dataset: https://archive.ics.uci.edu/dataset/360/air+quality
This is a multivariate timeseries, where features represent measurement from different air quality sensors (every hour for a year). There are missing values marked with value -200. For this reasons I suggest to discard feature NMHC(GT) as it has far too many missing values. For the other features (sensors), handle the missing value by imputation: e.g. use the average value between the preceeding and the following observation or, if many missing value are in a row, copy the measurament from the same sensor, same time, but the day before (or after, up to you).
Analyse the correlation of the sensor measuramentes by computing the cross-correlation between the timeseries corresponding to the different sensors. Are there sensors wich are more correlated? Are there sensors which are less correlated? Report you considerations on the analysis.
Consider the following dataset: https://www.kaggle.com/datasets/imsparsh/single-chestmounted-accelerometer
It contains accelerometer timeseries for 15 participants performing 7 different physical activities.For this assignement focus on a single activity (of your choice) and consider the 15 participants (timeseries) you have. Your goal is to see if there are similarities and differences in the behaviour of the accelerometers of these 15 participants. In other words, you need to see how they cluster. To achieve this goal, you can use one of the techniques we have seen during the lecture, e.g.:
- Fit an autoregressive (ARMA) model for each participant and then compare them based on the values of their ARMA coefficients (alpha and beta values)
- Transform the timeseries in the Fourier domain and compare them on their power spectrum
- ... any other thing that makes sense ...
You don't need to do the actual clustering with a clustering algorithm, as soon as you can discuss similarities and differences of the "profiles" you have constructed.
Hint: If you opt for the autoregressive analysis, you can use the autoregressive model of your choice (AR, ARMA, ...). In Python, use the ARIMA class of the statsmodels library (e.g. set order=(3,0,0) for an AR of order 3); in Matlab you can use the ar function to fit the model and the forecast function to test.
Assignment 3
Consider the following dataset: https://www.kaggle.com/datasets/imsparsh/single-chestmounted-accelerometer
It contains accellerometer timeseries for 15 participants performing 7 different physical activities.For this assignement focus on a single participant (of your choice) and study its 7 different activities using the Continous Wavelet Decomposition (CWD) approach discussed during the lectures. It suffices to compare the CWD visually and report you considerations on similarities and differences between the activities.
Note: you need to run the CDW separately for each accelerator channel. You can choose the wavelet family you prefer more (at random is also ok). In Python you may want to use Pywavelets or in Matlab the bundled Wavelet Toolbox (or you can use any other language and library that makes sense to you, but for this assignment I strongly advise Matlab).
Assignment 4
Image processing assignments
All the image processing assignments require to use the following dataset:
www.kaggle.com/datasets/ztaihong/weizmann-horse-database/data
The dataset contains in the horse directory 327 pictures of horses and in the mask directory where each image correspond to one image in the horse directory, and reports the corresponding manual segmentation of the horse.
Assignment 5
Perform image segmentation on all images in the dataset, using the normalized cut algorithm running on the top of superpixels rather than on raw pixels. For each image compute an accuracy metric (which one it is up to you to decide) measuring the overlap between the segments identified by NCUT and the ground truth horse semantic segmentation. Provide a table summarizing the average segmentation accuracy on all images, plus present 2 examples of images that are well-segmented (according to the above defined metric).
Hint: in Python, you have an NCut implementation in the scikit-image library;
in Matlab, you can use the original NCut implementation here. Superpixels are implemented both in Matlab as well as in OpenCV. Feel free to pickup the implementation you liked most (and motivate the choice).
Assignment 6
Extract the SIFT
descriptors using the visual feature detector embedded
in SIFT from the horse pictures
to identify the points of interest. Aggregate all the identified descriptors in a dataset and run k-means (or any clustering algorithm of your choice) on such data to partition the descriptors in clusters. Then analyze the obtained clusters by confronting the descriptors assigned to each cluster with the area of the semantic segmentation they end-up (in other words, compute a confusion matrix between the clusters and the 2 segmentation classes, horse and background). Discuss your findings. Choice of the number of clusters and of the clustering algorithm is on you (and should be discussed in the report).
Assignment 7
Implement the convolution of a Laplacian of a Gaussian blob (LoG) detector with an image
and apply it to 3-4 images of your choice from the dataset. Do not use library functions for implementing the convolution or to generate the LoG filter. Implement
your own and show the code (the interesting bits at least)! The function you implement should be able to run the LoG for different choices of the scale parameter, which is passed as an input argument. Show the results of your code on the 3-4 example images, for different choices of the scale parameter (sigma).