Intial commit, added weeks 1-3

This commit is contained in:
Oscar Blue 2022-02-23 23:13:00 +00:00
commit cc577fb01c
14 changed files with 282 additions and 0 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "themes/hugo-book"]
path = themes/hugo-book
url = https://github.com/alex-shpak/hugo-book

0
.hugo_build.lock Normal file
View file

6
archetypes/default.md Normal file
View file

@ -0,0 +1,6 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

114
config.yaml Normal file
View file

@ -0,0 +1,114 @@
# hugo server --minify --themesDir ... --baseURL=http://0.0.0.0:1313/theme/hugo-book/
baseURL: https://mmp.oscar.blue/
title: MMP | Oscar Pocock
theme: hugo-book
# Book configuration
disablePathToLower: true
enableGitInfo: false
# Needed for mermaid/katex shortcodes
markup:
goldmark:
renderer:
unsafe: true
tableOfContents:
startLevel: 1
# Multi-lingual mode config
# There are different options to translate files
# See https://gohugo.io/content-management/multilingual/#translation-by-filename
# And https://gohugo.io/content-management/multilingual/#translation-by-content-directory
languages:
en:
languageName: English
contentDir: content
weight: 1
# ru:
# languageName: Russian
# contentDir: content.ru
# weight: 2
# zh:
# languageName: Chinese
# contentDir: content.zh
# weight: 3
menu:
# before: []
after:
- name: "Aberystwyth MMP Site"
url: "https://teaching.dcs.aber.ac.uk/mmp"
weight: 10
- name: "Source Code"
url: "https://git.oscar.blue"
weight: 20
params:
# (Optional, default light) Sets color theme: light, dark or auto.
# Theme 'auto' switches between dark and light modes based on browser/os preferences
BookTheme: "light"
# (Optional, default true) Controls table of contents visibility on right side of pages.
# Start and end levels can be controlled with markup.tableOfContents setting.
# You can also specify this parameter per page in front matter.
BookToC: true
# (Optional, default none) Set the path to a logo for the book. If the logo is
# /static/logo.png then the path would be logo.png
# BookLogo: /logo.png
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# BookMenuBundle: /menu
# (Optional, default docs) Specify root page to render child pages as menu.
# Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/
# For backward compatibility you can set '*' to render all sections to menu. Acts same as '/'
BookSection: docs
# Set source repository location.
# Used for 'Last Modified' and 'Edit this page' links.
# BookRepo: https://github.com/alex-shpak/hugo-book
# (Optional, default 'commit') Specifies commit portion of the link to the page's last modified
# commit hash for 'doc' page type.
# Requires 'BookRepo' param.
# Value used to construct a URL consisting of BookRepo/BookCommitPath/<commit-hash>
# Github uses 'commit', Bitbucket uses 'commits'
# BookCommitPath: commit
# Enable "Edit this page" links for 'doc' page type.
# Disabled by default. Uncomment to enable. Requires 'BookRepo' param.
# Edit path must point to root directory of repo.
BookEditPath: edit/main/exampleSite
# Configure the date format used on the pages
# - In git information
# - In blog posts
BookDateFormat: "January 2, 2006"
# (Optional, default true) Enables search function with flexsearch,
# Index is built on fly, therefore it might slowdown your website.
# Configuration for indexing can be adjusted in i18n folder per language.
BookSearch: true
# (Optional, default true) Enables comments template on pages
# By default partals/docs/comments.html includes Disqus template
# See https://gohugo.io/content-management/comments/#configure-disqus
# Can be overwritten by same param in page frontmatter
BookComments: true
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables portable links and link checks in markdown pages.
# Portable links meant to work with text editors and let you write markdown without {{< relref >}} shortcode
# Theme will print warning if page referenced in markdown does not exists.
BookPortableLinks: true
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables service worker that caches visited pages and resources for offline use.
BookServiceWorker: true
# /!\ This is an experimental feature, might be removed or changed at any time
# (Optional, experimental, default false) Enables a drop-down menu for translations only if a translation is present.
BookTranslatedOnly: false

9
content/_index.md Normal file
View file

@ -0,0 +1,9 @@
---
title: Homepage
bookToc: false
type: main
---
# Autophotographer
This project aims to automate the process of selecting "aesthetic" images from a video feed.

View file

@ -0,0 +1,7 @@
---
weight: 1
bookFlatSection: true
title: "Developer Documentation"
---
This is the developer documentation. (Work-in-progress)

View file

@ -0,0 +1,7 @@
---
weight: 1
bookFlatSection: true
title: "User Documentation"
---
This is the user documentation. (Work-in-progress)

7
content/posts/_index.md Normal file
View file

@ -0,0 +1,7 @@
---
menu:
after:
name: blog
weight: 5
title: Blog
---

37
content/posts/week-1.md Normal file
View file

@ -0,0 +1,37 @@
---
title: "Week 1"
date: 2022-02-06T12:46:51Z
---
This week is the first week of the project. I researched academic papers, existing code and dataset relating to the topic of determining aesthetics.
# Papers
[Photo Aesthetics Analysis via DCNN Feature Encoding](https://ieeexplore.ieee.org/document/7886320)[^1] - Predicting aesthetic performance using a bespoke CNN solution
[^1]: H. -J. Lee, K. -S. Hong, H. Kang and S. Lee, "Photo Aesthetics Analysis via DCNN Feature Encoding," in IEEE Transactions on Multimedia, vol. 20, no. 8, pp. 1921-1932, Aug. 2017, doi: 10.1109/TMM.2017.2687759.
[AVA: A large-scale database for aesthetic visual analysis](https://ieeexplore.ieee.org/document/6247954)[^2] - Making of an aestehtic visual analysis dataset
[^2]: N. Murray, L. Marchesotti and F. Perronnin, "AVA: A large-scale database for aesthetic visual analysis," 2012 IEEE Conference on Computer Vision and Pattern Recognition, 2012, pp. 2408-2415, doi: 10.1109/CVPR.2012.6247954.
# Code
[Image Quality Assessment](https://github.com/idealo/image-quality-assessment) - Convolutional Neural Networks to predict the aesthetic and technical quality of images.
# Datasets
[AADB](https://github.com/aimerykong/deepImageAestheticsAnalysis)
AVA: https://github.com/imfing/ava_downloader, https://github.com/ylogx/aesthetics/tree/master/data/ava
# Project idea from research
Based on the research, I decided a machine learning approach would result in higher quality outputs. Although, I was slightly concerned that following a deep-learning would limit interesting discussion in my report.
The idea was to create a program that can take a video, break it down into frames and use a trained CNN to predict the most aesthetic frames and return them to the user.
# Weekly 1:1 meeting
During the meeting I mentioned my concerns following a deep learning approach. Although this approach might provide quality results, it doesn't provide much room to discuss or develop interesting solutions. Instead, as Hannah put, it mostly depends on throwing the problem at powerful hardware to get the best output which doesn't make for an interesting project. Hannah suggested I take a hybrid approach where I could use deep-learning for the last step in the pipeline, depending more on conventional engineering techniques to reduce the input data before passing it to the deep-learning stage.
She mentioned 'dumb' ways in which I could reduce the set of input frames:
- Comparing file sizes and removing the small ones (might infer single colour images / less complex images)
- Fourier frequency analysis
- Brightness and contrast analysis

50
content/posts/week-2.md Normal file
View file

@ -0,0 +1,50 @@
---
title: "Week 2"
date: 2022-02-13T12:46:54Z
---
This week I set up my repositories and starting writing some basic code.
# Set up
Before starting any coding, I wanted to set up my remote git repositories. I had already decided I wanted the project mirrored over two remote git repositories from different providers as a safety precaution. My intial plan was to use the university's GitLab instance but as it's recently been moved behind the firewall it would have made mirroring quite difficult. Instead, I decided to use my personal [Gitea instance](https://git.oscar.blue) and mirror it to my personal account on the official [GitLab instance](https://gitlab.com/oscarpocock).
[Gitea](https://git.oscar.blue/noble/mmp-osp1) → [GitLab](https://gitlab.com/oscarpocock/mmp-osp1)
Gitea will periodically push to GitLab.
# Code
Towards the end of the week I put together some simple code to reduce the frame set. I used the OpenCV Python module to export the frames of a given video to an `output/` folder. The path of this folder is also stored in the `outputfolder` variable we see used on line 7.
Although this code is a first step at reducing the frames set - it doesn't give us much feedback about the frames that have been deleted or kept.
```python {linenos=table, linenostart=1}
def display_file_sizes():
"""Calculates the average frame filesize and deletes the frames lower
than the average
"""
# create an array storing the filesize of each frame
filesizes = []
for filename in os.listdir(outputfolder):
filepath = outputfolder + "/" + filename
filesize = os.path.getsize(filepath)
print(filepath + ": " + str(filesize))
filesizes.append(filesize)
# work out average
average = sum(filesizes)/len(filesizes)
print ("Average is: " + str(average))
# delete files below average
count = 0
for filename in os.listdir(outputfolder):
filepath = outputfolder + "/" + filename
if filesizes[count] < average:
# print(filepath + ": " + str(filesizes[count]))
os.remove(filepath)
count += 1
```
I didn't end up doing as much as I would have liked this week. I found myself preoccupied in other areas of my life and not putting enough emphasis on this project.
# 1:1 Weekly meeting
- As I didn't do as much as I would like to have done there wasn't much to discuss on my part
- I needed to produce more code to have some basic functionality.
- Discussed my concerns with a machine learning approach

39
content/posts/week-3.md Normal file
View file

@ -0,0 +1,39 @@
---
title: "Week 3"
date: 2022-02-20T12:46:55Z
---
# Filming footage
At the start of the week I went into town to film some practise footage to work with later (up until this point I had been experimenting with footage limited by my bedroom walls). I took some basic vertical and horizontal footage of the town - no nature or breach footage yet.
# Gaining more useful information
I used the footage I had recorded at the start of the week and revised my "filesize" code. I made a new function `order_frames_by_filesize()` which orders the frames by the filesize and prints the name of size of each frame in order.
```python {linenos=table}
def order_frames_by_filesize():
"""Order the frames by filesize and print the filenames and their sizes"""
frames = os.listdir(outputfolder)
# sort the frames by their filesize
frames = sorted(frames,
key = lambda x: os.stat(os.path.join(outputfolder, x)).st_size, reverse = True)
# print every frame and it's size in a human readable format
for frame in frames:
filesize = os.stat(os.path.join(outputfolder, frame)).st_size
if filesize > 1024:
filesize = filesize / 1024
print(frame + ": " + str(filesize) + " KB")
else:
print(frame + ": " + str(filesize))
```
# Analysing datasets
There's been a few datasets that I've previously looked at which could be useful to use for this project. I wasn't sure how they would perform with the data I was expecting to use. AVA[^1] was trained on data that had been photographed under ideal conditions by profesionals. This won't reflect the frames extracted by the footage in this project's use case. I wasn't sure if this distinction was significant enough to effect the results of a trained model. I had previously found a project[^2] which had models pretrained using AVA[^1] I could use to predict an aesthetic value from images I provided.
[^1]: N. Murray, L. Marchesotti and F. Perronnin, "AVA: A large-scale database for aesthetic visual analysis," 2012 IEEE Conference on Computer Vision and Pattern Recognition, 2012, pp. 2408-2415, doi: 10.1109/CVPR.2012.6247954.
[^2]:Image Quality Assessment: https://github.com/idealo/image-quality-assessment - Idealo
# 1:1 Weekly meeting
- We discussed that during week 4 I should be looking at implementing CNNs as training might take a while and therefore should be a priority.
- Look at what other people are doing with aesthetic analysis to get an idea on how the code works.
- Attempt to get a basic CNN working.

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"Target":"book.min.68be0b7a9674f2a612ce0e9b2e9447ff4b7ac96546e06b642bfd3ded0ca490ef.css","MediaType":"text/css","Data":{"Integrity":"sha256-aL4LepZ08qYSzg6bLpRH/0t6yWVG4GtkK/097QykkO8="}}

1
themes/hugo-book Submodule

@ -0,0 +1 @@
Subproject commit 9e9c7d34038a830d22397bbec08e7ec64eb0a0d7