Data-310-Public-Raposo

Data 310 project summaries

View the Project on GitHub aeraposo/Data-310-Public-Raposo

Project 3: “All aboard the struggle bus”

computer on fire
(This isn’t my computer but it definitely sounded like this might happen when I was running my CNN)

About the data:
For project 3, we were provided with 10,000 images of Korle Gonno, a town in Accra, Ghana. Each image is 480x480 pixels and contains 3 bytes per pixel. Accra is ~225.7 km^2 so each of the 10,000 images represents ~0.02257 km^2 of the total area. The images, known as orthophotos, were taken from an aircraft and are of a high resolution (~60cm). For each photo, the approximate population residing within the pictured area was recorded in a csv file, where each entry corresponds to the assigned name of each photo (for example, the population of ‘1.jpeg’ is the first record value in the csv file).

The process: Using the above dataset, I built a model that predicts the population within a given image. I went about this process in 3 ways with varrying levels of success and run times (hence, “all aboard the struggle bus” became my personal montra for the weekend). Before I began, I downloaded the labels (population sizes) csv and unpacked the zipfiles containing the images. After moving them into a file with my desired file path, I began my first attempt.

Results: Something I quickly realized was that ‘Accuracy’ was not a helpful metric in evaluating the success of my model. This was because this number was often so low that it read ‘0000000 e0’, so I decided to focus on MSE and MAE. MSE is an ancronym for mean squared error, a measure of the average squared distance of outputs/predictions from the true values. MAE stands for mean absolute error is the average ditance between predictions and the actual values (source). Both of these measures are used to gauge a model’s performance- higher values generally indicate a poor model. Note that distance is >= 0. Next, I will detail four of my more notable CNN runs.

Note: After increasing number of epochs for each model, my results changed insignificaly and my accuracy remained at 0.

run 4(a)

Run 4(a): Based on my results for run 2, I worried that fitting my model using such small parameters and larger quantities of data would yield poor results, however, the additional convolution and pooling layers seemed to help avoid the irregularity seen in run 2 results. The testing loss (MSE) was just 106.3372 and MAE was 7.5652. Similarly to the graph from run 3, MSE and MAE steadily decreased as training progressed. Additionally, the maximum and minimum values for MSE and MAE were also considerably lower than in the last run.

run 4(b)

Run 4(b): This run, I increased batch size to 50. Although it took ~3 hours to complete fitting, I was left with a testing loss of 89.6446 and MAE of 5.9938. Comparatively, these graphs reflect a greater amount of detail (becuase we are working with smaller numbers, visibly smaller change is more significant. An interesting part about this graph is the increase in error at 8 epochs. This increase may be ‘temporary’ and we could see a further decrease in error beyond 10 epochs, however, it may be that the model becomes overfit or innacurate after this point.

Applications: Although my model was highly innacurate, similar models could be useful in the following ways:

Ways to improve: My PyCharm will not show matplotlib plots, even with simple examples (it has worked in the past but, for lack of better words, it seems insulted by my numberous long model runs) so I produced the above graphs in Google Colab. This definitely limited what plots I was able to make. If I was able, I would have produced plots of validation MSE, MAE, and accuracy. I would have also produced a plot showing the convolutions for an image, similarly to what we did for the mnsit dataset in the class exercise from the 14th.
In the future, I would like to add more convolution and pooling layers, change the activations, and change the number of neurons per layer, to see how accuracy would change- this would make another interesting graph too (how scores changed over convolutions). Although my model didn’t turn out very well, I learned a lot in the process and would like to try it on images of other areas of the world and different terrains to see how it performs.

Learning process

Conclusion: After giving my computer a brief reprieve from fitting, I ran the following images through the model. Unfortunately, the model’s terrible predictive powers shown though.

accra_1

Model prediction: 20.085924
True value: 36.1680641174316

accra_2

Model prediction: 18.063229
True value: 24.4707736968994

accra_3

Model prediction: 18.373161
True value: 35.9370880126953

It is possible that the model is overfit. This is supported by my relatively smooth graphs above and the fact that the model can seemingly only predict values in a small window (~18-20 based on my limited examples above). It may also be that the model is underfit because of the small training set, batch sizes, and low epochs. As I was unable to graph validations error/other scores, I am unable to tell which of these it the case.

Beyond challenges with fitting the model, the data itself also presents some limitations, including: