358 lines
14 KiB
HTML
358 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" dir="ltr">
|
|
|
|
<head>
|
|
<meta name="generator" content="Hugo 0.95.0" />
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="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.">
|
|
<meta name="theme-color" content="#FFFFFF"><meta property="og:title" content="Week 2" />
|
|
<meta property="og:description" content="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." />
|
|
<meta property="og:type" content="article" />
|
|
<meta property="og:url" content="https://mmp.oscar.blue/posts/week-2/" /><meta property="article:section" content="posts" />
|
|
<meta property="article:published_time" content="2022-02-13T12:46:54+00:00" />
|
|
<meta property="article:modified_time" content="2022-02-13T12:46:54+00:00" />
|
|
|
|
<title>Week 2 | MMP | Oscar Pocock</title>
|
|
<link rel="manifest" href="/manifest.json">
|
|
<link rel="icon" href="/favicon.png" type="image/x-icon">
|
|
<link rel="stylesheet" href="/book.min.68be0b7a9674f2a612ce0e9b2e9447ff4b7ac96546e06b642bfd3ded0ca490ef.css" integrity="sha256-aL4LepZ08qYSzg6bLpRH/0t6yWVG4GtkK/097QykkO8=">
|
|
<script defer src="/en.search.min.6bd18a0f048eff9ca273fd5ac40fe7159f145a30edf28a0847cab90265bd241a.js" integrity="sha256-a9GKDwSO/5yic/1axA/nFZ8UWjDt8ooIR8q5AmW9JBo="></script>
|
|
|
|
<script defer src="/sw.min.6f6f90fcb8eb1c49ec389838e6b801d0de19430b8e516902f8d75c3c8bd98739.js" integrity="sha256-b2+Q/LjrHEnsOJg45rgB0N4ZQwuOUWkC+NdcPIvZhzk="></script>
|
|
<!--
|
|
Made with Book Theme
|
|
https://github.com/alex-shpak/hugo-book
|
|
-->
|
|
|
|
|
|
</head>
|
|
|
|
<body dir="ltr">
|
|
<input type="checkbox" class="hidden toggle" id="menu-control" />
|
|
<input type="checkbox" class="hidden toggle" id="toc-control" />
|
|
<main class="container flex">
|
|
<aside class="book-menu">
|
|
<div class="book-menu-content">
|
|
|
|
<nav>
|
|
<h2 class="book-brand">
|
|
<a href="/"><span>MMP | Oscar Pocock</span>
|
|
</a>
|
|
</h2>
|
|
|
|
|
|
<div class="book-search">
|
|
<input type="text" id="book-search-input" placeholder="Search" aria-label="Search" maxlength="64" data-hotkeys="s/" />
|
|
<div class="book-search-spinner hidden"></div>
|
|
<ul id="book-search-results"></ul>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
|
|
<li class="book-section-flat" >
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://mmp.oscar.blue/docs/developer/" class="">Developer Documentation</a>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="book-section-flat" >
|
|
|
|
|
|
|
|
|
|
|
|
<a href="https://mmp.oscar.blue/docs/user/" class="">User Documentation</a>
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
<a href="/posts/" >
|
|
Blog
|
|
</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="https://teaching.dcs.aber.ac.uk/mmp" target="_blank" rel="noopener">
|
|
Aberystwyth MMP Site
|
|
</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a href="https://git.oscar.blue" target="_blank" rel="noopener">
|
|
Source Code
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
<script>(function(){var e=document.querySelector("aside.book-menu nav");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script>
|
|
|
|
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
<div class="book-page">
|
|
<header class="book-header">
|
|
|
|
<div class="flex align-center justify-between">
|
|
<label for="menu-control">
|
|
<img src="/svg/menu.svg" class="book-icon" alt="Menu" />
|
|
</label>
|
|
|
|
<strong>Week 2</strong>
|
|
|
|
<label for="toc-control">
|
|
|
|
<img src="/svg/toc.svg" class="book-icon" alt="Table of Contents" />
|
|
|
|
</label>
|
|
</div>
|
|
|
|
|
|
|
|
<aside class="hidden clearfix">
|
|
|
|
|
|
<nav id="TableOfContents">
|
|
<ul>
|
|
<li><a href="#set-up">Set up</a></li>
|
|
<li><a href="#code">Code</a></li>
|
|
<li><a href="#11-weekly-meeting">1:1 Weekly meeting</a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
|
|
|
|
</aside>
|
|
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<article class="markdown">
|
|
<h1>
|
|
<a href="/posts/week-2/">Week 2</a>
|
|
</h1>
|
|
|
|
<h5>February 13, 2022</h5>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<p>This week I set up my repositories and starting writing some basic code.</p>
|
|
<h1 id="set-up">
|
|
Set up
|
|
<a class="anchor" href="#set-up">#</a>
|
|
</h1>
|
|
<p>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
|
|
<a href="https://git.oscar.blue">Gitea instance</a> and mirror it to my personal account on the official
|
|
<a href="https://gitlab.com/oscarpocock">GitLab instance</a>.</p>
|
|
<p>
|
|
<a href="https://git.oscar.blue/noble/mmp-osp1">Gitea</a> →
|
|
<a href="https://gitlab.com/oscarpocock/mmp-osp1">GitLab</a></p>
|
|
<p>Gitea will periodically push to GitLab.</p>
|
|
<h1 id="code">
|
|
Code
|
|
<a class="anchor" href="#code">#</a>
|
|
</h1>
|
|
<p>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 <code>output/</code> folder. The path of this folder is also stored in the <code>outputfolder</code> variable we see used on line 7.</p>
|
|
<p>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.</p>
|
|
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">
|
|
<table style="border-spacing:0;padding:0;margin:0;border:0;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
|
|
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">14
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">15
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">16
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">17
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">18
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">19
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">20
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">21
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">22
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">23
|
|
</span><span style="white-space:pre;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">24
|
|
</span></code></pre></td>
|
|
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
|
|
<pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">display_file_sizes</span>():
|
|
</span></span><span style="display:flex;"><span><span style="color:#e6db74">"""Calculates the average frame filesize and deletes the frames lower
|
|
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">than the average
|
|
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">"""</span>
|
|
</span></span><span style="display:flex;"><span> <span style="color:#75715e"># create an array storing the filesize of each frame</span>
|
|
</span></span><span style="display:flex;"><span> filesizes <span style="color:#f92672">=</span> []
|
|
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">for</span> filename <span style="color:#f92672">in</span> os<span style="color:#f92672">.</span>listdir(outputfolder):
|
|
</span></span><span style="display:flex;"><span> filepath <span style="color:#f92672">=</span> outputfolder <span style="color:#f92672">+</span> <span style="color:#e6db74">"/"</span> <span style="color:#f92672">+</span> filename
|
|
</span></span><span style="display:flex;"><span> filesize <span style="color:#f92672">=</span> os<span style="color:#f92672">.</span>path<span style="color:#f92672">.</span>getsize(filepath)
|
|
</span></span><span style="display:flex;"><span> print(filepath <span style="color:#f92672">+</span> <span style="color:#e6db74">": "</span> <span style="color:#f92672">+</span> str(filesize))
|
|
</span></span><span style="display:flex;"><span> filesizes<span style="color:#f92672">.</span>append(filesize)
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span> <span style="color:#75715e"># work out average</span>
|
|
</span></span><span style="display:flex;"><span> average <span style="color:#f92672">=</span> sum(filesizes)<span style="color:#f92672">/</span>len(filesizes)
|
|
</span></span><span style="display:flex;"><span> print (<span style="color:#e6db74">"Average is: "</span> <span style="color:#f92672">+</span> str(average))
|
|
</span></span><span style="display:flex;"><span>
|
|
</span></span><span style="display:flex;"><span> <span style="color:#75715e"># delete files below average</span>
|
|
</span></span><span style="display:flex;"><span> count <span style="color:#f92672">=</span> <span style="color:#ae81ff">0</span>
|
|
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">for</span> filename <span style="color:#f92672">in</span> os<span style="color:#f92672">.</span>listdir(outputfolder):
|
|
</span></span><span style="display:flex;"><span> filepath <span style="color:#f92672">=</span> outputfolder <span style="color:#f92672">+</span> <span style="color:#e6db74">"/"</span> <span style="color:#f92672">+</span> filename
|
|
</span></span><span style="display:flex;"><span> <span style="color:#66d9ef">if</span> filesizes[count] <span style="color:#f92672"><</span> average:
|
|
</span></span><span style="display:flex;"><span> <span style="color:#75715e"># print(filepath + ": " + str(filesizes[count]))</span>
|
|
</span></span><span style="display:flex;"><span> os<span style="color:#f92672">.</span>remove(filepath)
|
|
</span></span><span style="display:flex;"><span> count <span style="color:#f92672">+=</span> <span style="color:#ae81ff">1</span>
|
|
</span></span></code></pre></td></tr></table>
|
|
</div>
|
|
</div><p>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.</p>
|
|
<h1 id="11-weekly-meeting">
|
|
1:1 Weekly meeting
|
|
<a class="anchor" href="#11-weekly-meeting">#</a>
|
|
</h1>
|
|
<ul>
|
|
<li>As I didn’t do as much as I would like to have done there wasn’t much to discuss on my part</li>
|
|
<li>I needed to produce more code to have some basic functionality.</li>
|
|
<li>Discussed my concerns with a machine learning approach</li>
|
|
</ul>
|
|
</article>
|
|
|
|
|
|
|
|
<footer class="book-footer">
|
|
|
|
<div class="flex flex-wrap justify-between">
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</footer>
|
|
|
|
|
|
|
|
<div class="book-comments">
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<label for="menu-control" class="hidden book-menu-overlay"></label>
|
|
</div>
|
|
|
|
|
|
<aside class="book-toc">
|
|
<div class="book-toc-content">
|
|
|
|
|
|
<nav id="TableOfContents">
|
|
<ul>
|
|
<li><a href="#set-up">Set up</a></li>
|
|
<li><a href="#code">Code</a></li>
|
|
<li><a href="#11-weekly-meeting">1:1 Weekly meeting</a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
|
|
|
|
</div>
|
|
</aside>
|
|
|
|
</main>
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|