<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cate Seale on Medium]]></title>
        <description><![CDATA[Stories by Cate Seale on Medium]]></description>
        <link>https://medium.com/@catherineseale?source=rss-f9c6aa918b08------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9aS1gegQeGCW6yhBedSVAw.jpeg</url>
            <title>Stories by Cate Seale on Medium</title>
            <link>https://medium.com/@catherineseale?source=rss-f9c6aa918b08------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 22:32:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@catherineseale/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Building Data Science Capability at UKHO: our January 2022 Research Week]]></title>
            <link>https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-january-2022-research-week-31106b16756?source=rss-f9c6aa918b08------2</link>
            <guid isPermaLink="false">https://medium.com/p/31106b16756</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[uk-government]]></category>
            <dc:creator><![CDATA[Cate Seale]]></dc:creator>
            <pubDate>Wed, 02 Feb 2022 10:50:05 GMT</pubDate>
            <atom:updated>2022-02-02T10:50:05.978Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This blog was co-authored by Dr Susan Nelmes, Andrew Smith, </em><a href="https://medium.com/@jiriklic"><em>Jiri Klic</em></a><em> and </em><a href="https://www.linkedin.com/in/thomas-redfern-885219130/"><em>Dr Thomas Redfern</em></a><em>.</em></p><p>Hello and welcome to our first data science roundup of 2022! I’m here as your guide to our regular quarterly blog post in which we share our ‘<em>research week’ </em>findings, as we explore the interesting bits of data science and machine learning. This month, the team look at digital twins, platforms for model evaluation, detecting subtle changes in images and finding structure in unstructured data.</p><h3>Firstly, what is a research week?</h3><p>Members of the Data Science team at the UKHO come up with excellent ideas for how we can apply the latest in machine learning or big data research to the marine data domain. Sometimes these ideas are outside the scope of our current project deliverables so, to push the boundaries of what is possible, every quarter we conduct a ‘<em>research week’</em> — an allocated time for data scientists to experiment with new ideas, techniques and technologies.</p><p>In this blog, we outline our work, how it might tie into our future projects, and how the lessons learned will help with future projects.</p><h3><strong>Andrew Smith: Qualitatively evaluating computer vision models</strong></h3><p>Developing systems that efficiently utilise any machine learning capability is often quite a complex process. It typically involves many steps like defining a problem to be solved, collecting and cleaning data, training a model, deploying the model to production and monitoring performance. Each of these steps themselves can be quite complicated with many moving parts. Consequently, evaluating and debugging a machine learning system can be quite a time-consuming process, with compute vision problems often being additionally cumbersome given the nature of the data. Fortunately, there are many open-source tools that are available to help us with this process — the openness of data science communities is one of the key reasons I believe this field moves so fast, and I am very grateful to these for all the fantastic tools (and associated research, documentation, tutorials, blogs, videos,…).</p><p><a href="https://pyviz.org/index.html">PyViz</a> is a very useful resource for learning about a large number of python based visualisation tools. These tools are useful for a wide range of purposes including geospatial visualisation. I have found many of the libraries listed here very useful for building more custom applications regarding qualitatively evaluating machine learning pipelines (computer vision and otherwise).</p><p>Another tool I have recently come across is <a href="https://github.com/voxel51/fiftyone">FiftyOne</a>. This tool is more specific to the purpose of evaluating computer vision models and building high-quality data sets. It has many useful features like the ability to visualise (and validate) labelled data, to add tags to images (e.g. to mark images that are labelled incorrectly), to sort and filter images by some numeric score (which is very helpful, for example visually comparing the most correct and most incorrect images), functions to generate a wide range of plots of your data (including to create interactive geospatial plots, see image below), the ability to explore a number of large publicly available data sets like the Open Images Dataset, and much more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eguwm4E51qN_ki4Md0qbYg.gif" /><figcaption><em>Image credit: </em><a href="https://voxel51.com/docs/fiftyone/user_guide/plots.html#geolocation-plots"><em>https://voxel51.com/docs/fiftyone/user_guide/plots.html#geolocation-plots</em></a></figcaption></figure><h3>Dr Susan Nelmes: <strong>Spot the difference</strong></h3><p>My research week involved looking into the question of how we detect changes between images. In particular, by comparing screenshots before and after a code change in software production, can we check if it results in undesirable changes to the visual layout of its user interface.</p><p>A pixel-by-pixel comparison may seem the obvious choice, but differences in the way images are smoothed and rendered by different systems can result in changes that we might not want to count as a test failure if the essential content and layout remains the same.</p><p>The <a href="https://scikit-image.org/docs/dev/auto_examples/transform/plot_ssim.html">structural similarity index measure (SSIM)</a> tries to better mimic how humans would assess images by identifying the visual information gained from the image. Applying this to a screenshot where I have modified the position of one of the buttons, shows it identifies the change, shown in cyan, easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*Jv2IeFI4pQFrdqwXQx71oA.png" /><figcaption>a) Original screenshot of UKHO software b) Modified screenshot c) Differences (cyan) found using SSIM.</figcaption></figure><p><a href="https://www.hackerfactor.com/blog/?/archives/432-Looks-Like-It.html">Image hashing algorithms </a>are another method for comparing the similarity of images. Normally applied to whole images, I investigated gridding an image up and applying them to individual parts. The algorithms reduce an image, or part of it, down to a hash which can then be compared with another image hash, with similar hashes implying similar images. Using this, parts of the screenshots can be assessed for changes. To do this I used the Python package <a href="https://pypi.org/project/ImageHash/">ImageHash</a>.</p><p>Finally, I also looked at feature detection, descriptors and matching. <a href="https://www.analyticsvidhya.com/blog/2021/06/feature-detection-description-and-matching-of-images-using-opencv/">A good explanation can be found here</a>. Both the Python packages opencv and scikit-image offer functions for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*TtepoAYb7hXWV_kQgqVdNQ.png" /><figcaption>a) Matches (green) between features (black circles) in the original and modified screenshots b) Only matches of features that have moved position c) Features (red circles) that are unmatched.</figcaption></figure><p>All these methods worked well on a simple modification to the layout, but further investigation is required to see if they could be optimised to produce good results when differences in smoothing and rendering are applied to the screenshots.</p><h3>Dr Thomas Redfern: Finding structure in un-structured data</h3><p>In this research week I investigated the use of Auto-encoders and dimensionality reduction techniques to find structure in un-structured imagery data. Imagine the scenario where you have a large volume of unlabelled imagery data and limited resource available for labelling. What’s the best way of splitting the imagery data up so that you can spread your labelling effort across different types of images? Can we find structure in the imagery, to best design a labelling approach that efficiently covers the variety and complexity within the imagery data?</p><p>An autoencoder is a machine learning algorithm that is trained to reproduce the input as its prediction. An autoencoder “learns” a representation of the input image, that is simpler than all of the input pixels. It finds structure. I trained a fully convolutional neural network autoencoder (based on the UNET architecture) to reproduce the MNIST data set (a series of 28x28 pixel images of handwritten digits). I then used the TSNE dimensionality reduction algorithm to produce a 2-dimensional plot of the features that the encoder had learnt. Without any labels to help, I wanted to see if the autoencoder was able to tell the difference between different hand drawn digits. This was the result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/387/1*PpP1LPzhYgc_Nva_OiW_WA.png" /><figcaption>Figure 1: TSNE coordinates plotted for MNIST representations from within the auto-encoder.</figcaption></figure><p>As Figure 1 shows, there is a good degree of separation between most of the different hand drawn digits with some overlap between 5s and 3s and 9s and 4s. The next steps of this work would be to transfer this process to satellite imagery, a topic that is being studied by our sponsored PhD project at the University of Swansea.</p><h3>Jiri Klic: Digital twins</h3><p>The digital twin concept has been known for over two decades and is used primarily in engineering and manufacturing. By creating a detailed digital replica of a physical object, we can simulate its behaviour under different conditions. This process can provide valuable insight that would be too difficult or dangerous to obtain with real-life experiments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*yI1fFWrkkujBxAmYyoW70g.png" /><figcaption><em>Grieves, M. (2016) Origins of the digital twin Concept. doi: </em><a href="https://doi.org/10.13140/RG.2.2.26367.61609"><em>10.13140/RG.2.2.26367.61609</em></a><em>.</em></figcaption></figure><p>There is an increasing trend to use digital twins to simulate and analyse complex interconnected systems. This approach can be instrumental in supply chain management and maritime shipping. By using historical AIS data to model the global marine traffic, we could use a digital twin to run simulations of different scenarios that never even happened. Combining it with other data science techniques like multi-agent simulation or reinforcement learning can be a promising approach for voyage optimisation and analysis of unprecedented events like the <a href="https://en.wikipedia.org/wiki/2021_Suez_Canal_obstruction">Suez Canal obstruction</a> in March 2021.</p><p>During my initial investigation into the subject, I came across two large scale implementations of digital twins on a national and international level:</p><p><strong>The National Digital Twin</strong></p><p>The <a href="https://www.cdbb.cam.ac.uk/what-we-do/national-digital-twin-programme">National Digital Twin programme</a> (NDTp) aims to create a family of digital twins that could communicate via secure data sharing. It’s run by a partnership between the University of Cambridge and the Department for Business, Energy and Industrial Strategy in United Kingdom called the <a href="https://www.cdbb.cam.ac.uk/">Centre for Digital Built Britain</a> (CDBB). As part of NDTp, the CDBB published the <a href="https://www.cdbb.cam.ac.uk/DFTG/GeminiPrinciples">Gemini Principles</a> report in 2018, a collection of nine guiding principles to ensure the purpose, trust and practical functionality of interconnected digital twins. They also created the <a href="https://digitaltwinhub.co.uk/">DT Hub</a>, an online space for digital twin developers to collaborate and exchange experiences.</p><p><strong>Destination Earth</strong></p><p><a href="https://digital-strategy.ec.europa.eu/en/library/destination-earth">Destination Earth</a> (DestinE) is the initiative of the European Commission to develop the Digital Twin of the Earth to monitor and predict an environmental change from human impact and support sustainable development. DestinE will allow users to test various strategies to tackle climate change and explore their potential consequences. The key contributors to this project are <a href="https://www.ecmwf.int/en/about/media-centre/news/2021/presenting-destination-earth-digital-replica-our-planet">ECMWF</a>, <a href="https://www.eumetsat.int/eumetsat-takes-key-role-innovate-project-model-earth-system">EUMETSAT</a>, and <a href="https://www.esa.int/Applications/Observing_the_Earth/Working_towards_a_Digital_Twin_of_Earth">ESA</a>. An inspiring project is the <a href="https://dte-antarctica.org/">Digital Twin of Antarctica</a>, developed in cooperation with the <a href="https://www.ed.ac.uk/informatics/news-events/stories/2020/scientists-to-create-a-digital-twin-of-antarctica">University of Edinburgh</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31106b16756" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-january-2022-research-week-31106b16756">Building Data Science Capability at UKHO: our January 2022 Research Week</a> was originally published in <a href="https://medium.com/uk-hydrographic-office">UK Hydrographic Office</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Data Science Capability at UKHO: our October 2021 Research Week]]></title>
            <link>https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-october-2021-research-week-33cb9bf92eed?source=rss-f9c6aa918b08------2</link>
            <guid isPermaLink="false">https://medium.com/p/33cb9bf92eed</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Cate Seale]]></dc:creator>
            <pubDate>Fri, 03 Dec 2021 10:23:53 GMT</pubDate>
            <atom:updated>2021-12-08T08:34:46.229Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This blog was co-authored by Dr Susan Nelmes, </em><a href="https://datalass1.medium.com/"><em>Rachel Keay</em></a>, <em>Andrew Smith and </em><a href="https://www.linkedin.com/in/thomas-redfern-885219130/"><em>Dr Thomas Redfern</em></a><em>.</em></p><h3>Using research weeks to push the boundaries of data science at the UKHO</h3><p>Welcome to our quarterly blog post in which we share our ‘<em>research week’ </em>findings, as we explore the interesting bits of data science and machine learning. This month, the team look at tools for big data, 3D visualisation, advanced reinforcement learning and data augmentation strategies for satellite imagery.</p><h3>Firstly, what is a research week?</h3><p>Members of the Data Science team at the UKHO come up with excellent ideas for how we can apply the latest in machine learning or big data research to the marine data domain. Sometimes these ideas are outside the scope of our current project deliverables so, to push the boundaries of what is possible, every quarter we conduct a ‘<em>research week’</em> — an allocated time for data scientists to experiment with new ideas, techniques and technologies.</p><p>In this blog, we outline our work, how it might tie into our future projects, and how the lessons learned will help with future projects.</p><h3>3D visualisation of bathymetric data: Rachel Keay</h3><p>When visually communicating the accuracy of a satellite derived bathymetry (SDB) machine learning model, I decided to go to the third dimension this research week.</p><p>Python libraries matplotlib and holoviews/plotly are part of my day-to-day data science toolkit. Matplotlib has a simple interface, supports many backends and operating systems, and other python packages are built on top of matplotlib. But, it can be verbose and is not desirable for creating dynamic and interactive graphics. Whereas, holoviews/plotly is a high-level tool built on top of Bokeh, matplotlib, and datashader and in a couple of lines I can output a default 3D visualisation of bathymetry data. So I used both; holoviews/plotly for quick interactive plots and matplotlib with Pillow to output visualisation animations as gifs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*qzKSHkVmYYpGTvfHW0bKGA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*m4CShAxiW8Aw2mi88tReGQ.gif" /><figcaption>Bathymetry surfaces in test location. Left: Bathymetric surface from LIDAR. Right: Satellite derived bathymetry.</figcaption></figure><p>Visualisation is used to discover, explore, and explain patterns in data. The matplotlib gifs show:</p><p>1. that the SDB surface is more textured, demonstrating uncertainty in the predictions.</p><p>2. there is a tendency to under-predict deeper depths, demonstrating that there is an “extinction depth” where the satellite multispectral bands no longer penetrate the water column to derive bathymetry ~ 20m.</p><h3><strong>Python tools for exploring, analysing and visualising big, labelled data</strong>: Dr Susan Nelmes</h3><p>I spent my research week getting up to speed with some of the common Python tools used to explore, analyse and visualise big, labelled data. To do this, I followed tutorials that originally ran during SciPy conferences <a href="https://www.scipy2020.scipy.org/tutorial-information">2020 </a>and <a href="https://www.scipy2021.scipy.org/tutorial-information">2021</a>, which have two days of tutorials before the main conference begins, both at a beginner and intermediate level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*zcXarPErDvkcdJk5lEHt5Q.png" /></figure><p>Like many data science teams, we often work with very large data sets that cannot be held in memory. One of the tools that can help with this is <a href="http://dask.org/">Dask</a>, a Python library for scaling and parallelizing code on a single machine or across a cluster. To learn more, I followed the Dask tutorial from SciPy2020, Parallel and Distributed Computing in Python with Dask (<a href="https://github.com/dask/dask-tutorial">material</a>, <a href="https://www.youtube.com/watch?v=EybGGLbLipI">video</a>), which provided a great introduction with informative exercises to work through.</p><p>Another tutorial from SciPy2021 focussed on a particular use case of applying Dask to explore AirBnB data (<a href="https://github.com/ramonpzg/scipyus21_dask_analytics">material</a>, <a href="https://www.youtube.com/watch?v=xajKJPVRG_I">video</a>) and was particularly insightful on the use of <a href="https://panel.holoviz.org/">Panel</a> to create interactive dashboards.</p><p>I also enjoyed the tutorial from SciPy2020 on <a href="http://xarray.pydata.org/">Xarray</a>, a Python package that allows labelled data to be manipulated as multi-dimensional arrays (<a href="https://xarray-contrib.github.io/xarray-tutorial/scipy-tutorial/00_overview.html#Tutorial-Setup">material</a>, <a href="http://www.youtube.com/watch?v=mecN-Ph_-78">video</a>). Xarray works well with Dask, and the tutorial provides examples and exercises on this.</p><p>The final tutorial that I followed was HoloViz (<a href="https://github.com/holoviz/holoviz/blob/master/doc/installation.rst">material</a>, <a href="https://www.youtube.com/watch?v=v0QiTptWt3w">video</a>), to visualize all your data easily, from notebooks to dashboards. This looked at ways to use hvPlot and, again, Panel to visualise and interact with data.</p><p>A great aspect of research weeks is that they allow you the time to take deeper dives into areas that take your interest or that are a tangent to the main topic. For example, it was interesting to look further into how Python works under the hood and understanding why the <a href="http://realpython.com/python-gil/">Global Interpreter Lock</a>, that allows only one <a href="https://realpython.com/intro-to-python-threading/">thread</a> to hold the control of the Python interpreter, affects how code can be parallelised. Another interesting tangent was looking into comparisons between Dask and other tools to parallelise Python code such as <a href="https://www.ray.io/">Ray</a> and <a href="https://modin.readthedocs.io/en/latest/">Modin</a>.</p><h3>Advanced reinforcement learning: Andrew Smith</h3><p>I have been interested in learning more about reinforcement learning since my initial blog post (found within <a href="https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-october-2020-research-week-55a3ed853448">this previous team blog post</a>). Reinforcement learning could be a very useful technology for some of our problems like determining optimal shipping routes and considerations around autonomous shipping. Consequently, for this research week I decided to learn more about <a href="https://arxiv.org/abs/1911.08265">MuZero</a>.</p><p>MuZero is a recent development from <a href="https://deepmind.com/">DeepMind</a>, the company with an aim of solving Artificial General Intelligence (AGI). The methods they have been developing have been getting more and more general, and MuZero is the most general of these methods. MuZero is capable of learning the rules of the environment it is acting in, in addition to benefitting from advances developed previously like the ability to learn entirely from self-play, and using a single algorithm to solve multiple games.</p><p>If you want to give MuZero a try yourself, I found <a href="https://github.com/werner-duvaud/muzero-general">this code repository</a> useful. The following resources were also found to be extremely helpful for learning more about it:</p><ul><li><a href="https://deepmind.com/blog/article/muzero-mastering-go-chess-shogi-and-atari-without-rules">MuZero blog post: Mastering Go, chess, shogi and Atari without rules</a></li><li><a href="https://medium.com/applied-data-science/how-to-build-your-own-muzero-in-python-f77d5718061a">MuZero: The Walkthrough</a></li><li><a href="https://www.furidamu.org/blog/2020/12/22/muzero-intuition/">MuZero Intuition</a></li><li><a href="https://www.youtube.com/watch?v=L0A86LmH7Yw">MuZero — ICAPS 2020</a></li></ul><h3>Data augmentation strategies for satellite imagery: Dr Thomas Redfern</h3><p>When training deep learning models for image segmentation tasks, we commonly use data augmentations to increase the volume and variety of our training data. Typically we might apply image rotations, flips and random crops. For natural images, or in settings where image exposure is well controlled, these augmentations allow a deep learning model to increase generalisation to different angles of capture. In satellite remote sensing imagery, the exposure of an image may vary as changes in sun angle, weather conditions, atmospheric interference and seasonality may alter the recorded reflectance of the Earth’s surface by a satellite sensor. Therefore, if we train a model using a labelled image from time t1, the exposure of an image used for inference at time t2 may be quite different and this may reduce the accuracy of our trained model. To overcome this problem, in this research week, I experimented with the development of an image exposure augmentation technique. I devised a number of different exposure adjustment strategies:</p><ul><li>All bands within a Sentinel-2 image were augmented by a fixed value e.g. new band value = original band value x an augmentation factor. I experimented with augmentations factors between 0.5 and 2.</li><li>Each individual band within a Sentinel-2 image was augmented by its own individual augmentation factor, again between 0.5 and 2.</li></ul><p>I used our pre-existing mangrove labelled train and test data sets and compared results to previous production and experimental models. Unfortunately, this experimentation yielded results that weren’t an improvement over previous models. I believe this could be because I was applying a different augmentation factor in each new epoch. A better technique may have been to create a larger fixed augmented data set first, and then train on all the imagery for a number of epochs — something to try next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33cb9bf92eed" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-october-2021-research-week-33cb9bf92eed">Building Data Science Capability at UKHO: our October 2021 Research Week</a> was originally published in <a href="https://medium.com/uk-hydrographic-office">UK Hydrographic Office</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Data Science Capability at UKHO: our July 2021 Research Week]]></title>
            <link>https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-july-2021-research-week-f9b81bbd3cfd?source=rss-f9c6aa918b08------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9b81bbd3cfd</guid>
            <category><![CDATA[meta-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[unet]]></category>
            <category><![CDATA[topic-modeling]]></category>
            <dc:creator><![CDATA[Cate Seale]]></dc:creator>
            <pubDate>Wed, 25 Aug 2021 11:53:45 GMT</pubDate>
            <atom:updated>2021-09-01T15:19:25.594Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This blog was co-authored by Andrew Smith, Dr Susan Nelmes, </em><a href="https://catherineseale.medium.com/"><em>Cate Seale</em></a>, <a href="https://www.linkedin.com/in/thomas-redfern-885219130/"><em>Dr Thomas Redfern</em></a><em> and </em><a href="https://datalass1.medium.com/"><em>Rachel Keay</em></a><em>.</em></p><h3>Using research weeks to push the boundaries of data science at the UKHO</h3><p>Welcome to our quarterly blog post in which we share our ‘<em>research week’ </em>findings, as we explore the interesting bits of data science and machine learning. This month, the team look at <strong>detecting offshore infrastructure, meta-learning, modelling text topics, adding residual units to convolutional neural networks, and satellite-derived bathymetry.</strong></p><h3>Firstly, what is a research week?</h3><p>Members of the Data Science team at the UKHO come up with excellent ideas for how we can apply the latest in machine learning or big data research to the marine data domain. Sometimes these ideas are outside the scope of our current project deliverables so, to push the boundaries of what is possible, every quarter we conduct a ‘<em>research week’</em> — an allocated time for data scientists to experiment with new ideas, techniques and technologies.</p><p>In this blog, we outline our work, how it might tie into our future projects, and how the lessons learned will help with future projects.</p><h3><strong>Detecting offshore infrastructure: Cate Seale</strong></h3><p>I’ve worked on <a href="https://ukhodigital.blog.gov.uk/2018/08/15/taking-part-in-sprint-18/">detecting uncharted hazards at sea</a> before, using blob detection to locate different types of offshore infrastructure. After a chance meeting, I found Brian Wong and Christian Thomas at <a href="https://skytruth.org/">SkyTruth</a> were working on the same thing. We bonded over oil platform design and whether wind turbines look different depending on which way they are pointing (classic icebreaker chat at a conference 😎). We also had different approaches to detecting infrastructure, so I was keen to implement the methodology from <a href="https://www.sciencedirect.com/science/article/pii/S0034425719304316">their paper</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*K0HhaT0ER4t0bjXNPh2_4Q.png" /><figcaption>Sentinel-1 coverage and availability for the North Sea in 2020.</figcaption></figure><p>The source data for both our approaches is Sentinel-1 synthetic aperture radar data from the <a href="https://www.esa.int/">European Space Agency</a>. I first visualised the available imagery for the North Sea captured in 2020 (loads!).</p><p>After creating a composite image using median pixels, there is a pre-processing step to remove the artefacts from compositing. First, a Mean Filtered image was created by passing a circular kernel over the composite, taking the mean value within the kernel. Then, the Mean Filtered image is subtracted from the composite. This was a simple step but worked impressively well at removing noise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*1cyverHYvm3ejHVBlibHbA.png" /><figcaption>The median composite on the left, the Mean Filtered image in the centre, and the Differenced Image (the composite minus the Mean Filtered image ) on the right.</figcaption></figure><p>A threshold is applied to the cleaned image to output a binary image showing bright clusters against a black background. Erosion and dilation is then performed on the clusters to remove noise from their edges, after which their centroids are detected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U3NZjdOBHZxRdauzzwlGlA.png" /><figcaption>Erosion and dilation of clusters to clean cluster edges. Image Credit: <a href="https://www.sciencedirect.com/science/article/pii/S0034425719304316">https://www.sciencedirect.com/science/article/pii/S0034425719304316</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/859/1*BAOLgDTx6RZgbpWgcF6Dvg.png" /><figcaption>My results detecting objects in the North Sea.</figcaption></figure><p>Using this method I was able to detect clusters (and therefore suspected infrastructure locations) for the whole of my area of interest.</p><p>I’m looking forward to integrating elements of this procedure (particularly the pre-processing and cleaning steps) as we work to iteratively improve our own methodology.</p><h3><strong>Learning about learning to learn via Meta-Learning: Andrew Smith</strong></h3><p>I have come across the term ‘meta-learning’ a number of times, and its popularity seems to be growing a lot in the last few years (an opinion I have formed mainly from Twitter). Consequently, I decided to learn more about this for my research week.</p><p>One of the motivations for meta-learning is that humans often learn new tasks quickly. The aim of meta-learning is to train a model that learns how to learn so that the model can adapt to new, unseen tasks quickly. Meta-learning systems are trained on a large number of tasks (each task consisting of only a small data set) and are then tested in their ability to learn new tasks. Here is one very impressive demo of meta-learning that is cable of mastering a new task after only the first episode!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*uh28GNWP4JgRjnGEOmEuGg.gif" /><figcaption>Image credit: <a href="https://bair.berkeley.edu/blog/2017/07/18/learning-to-learn/">https://bair.berkeley.edu/blog/2017/07/18/learning-to-learn/</a></figcaption></figure><p>Following this impressive example, I decided to attempt implementing this particular algorithm call MAML (Model-Agnostic Meta-Learning). Following the original paper, I experimented with using MAML to learn a sine wave. Each task consisted of training on only a few points from a sine wave that was generated with a different phase and amplitude. It worked surprisingly well:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*mjCYUQQtSTfBvwZyhQSd8w.png" /></figure><p>This investigation has suggested that this approach can work well for problems involving small data sets with lots of tasks. At the UKHO, we have lots of similar tasks (e.g. image segmentation problems on satellite data for mapping mangrove, kelp, coastline, …), and not always lots of training data, so future work could be undertaken to determine how well this approach works on our more specific problems.</p><h3><strong>Topic Modelling Methods: Susan Nelmes</strong></h3><p>My research week involved looking at how topic modelling can be applied to textual data. Topic modelling is an unsupervised Natural Language Processing (NLP) technique to discover topics in a collection of documents, which can range in length from tweets to books.</p><p>For example, looking at travel guides, topic modelling would pick out words that are in many of the books such as ‘hotel’ and ‘restaurant’ as irrelevant, but if two books both contain ‘volcano’, ‘surf’ and ‘palm trees’, they are likely to be about a similar topic and indeed a different topic to books containing ‘mountains’, ‘ski’ and ‘chocolate’. On visual inspection of the words that define these abstract topics, we might be able to apply topic labels such as ‘Hawaii’ and ‘Switzerland’.</p><h4>Pre-processing</h4><p>Before applying topic modelling methods, I pre-processed my data (short texts of one or two sentences). I removed digits and punctuation and transformed it to lowercase. I tokenised it (splitting it into individual words) and removed stopwords (commonly used words that don’t add topic meaning). I then lemmatised the data, reducing words to a common base form. For example, ‘am’, ‘are’ and ‘is’ would be reduced to ‘be’.</p><h4>Latent Dirichlet Allocation</h4><p>The first method I tried is one of the most popular: Latent Dirichlet Allocation (LDA). This is a probabilistic model that assumes each topic will have probability distribution of words associated with it and that each document contains a number of topics. LDA finds out, through an iterative process, which combination of topics would best produce the distribution of words in the documents.</p><p>To prepare my data I used <a href="https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html">CountVectorizer</a> and then implemented LDA using <a href="https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.LatentDirichletAllocation.html">LatentDirichletAllocation</a>. I also performed a search to find the best hyperparameter values to use. Additionally, I found the visualisation package <a href="https://pyldavis.readthedocs.io/en/latest/">pyLDAvis</a> fantastic for visualising my results.</p><p>However, the resulting topics were not reflecting my data well. I came across suggestions that another method, Non-negative Matrix Factorization (NMF), could work better for smaller data sets like mine, so I tried this next.</p><h4>Non-negative Matrix Factorization</h4><p><a href="https://en.wikipedia.org/wiki/Non-negative_matrix_factorization">Non-negative Matrix Factorization</a> (NMF) is another widely used topic modelling method. As the name suggests, it is a matrix factorization technique. A matrix of words by documents is factorised into two matrices, words by topics and topics by documents, with the second of these defining which topics are in each document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*e_v-cNBvotI8LzgDesBZog.png" /><figcaption>Image Credit: <a href="https://www.researchgate.net/figure/Conceptual-illustration-of-non-negative-matrix-factorization-NMF-decomposition-of-a_fig1_312157184">https://www.researchgate.net/figure/Conceptual-illustration-of-non-negative-matrix-factorization-NMF-decomposition-of-a_fig1_312157184</a></figcaption></figure><p>To prepare my data, I used the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html">TfidfVectorizer</a> and then implemented <a href="https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.NMF.html">NMF</a>. I found that the topics produced using this method were much more distinct and applicable to my data.</p><h3>Residual U-Nets: Thomas Redfern</h3><p>Following the success of our <a href="https://medium.com/uk-hydrographic-office/scaling-machine-learning-models-across-the-globe-the-quest-for-geo-generalisability-in-mangrove-f14282738378">work detecting mangrove forests</a>, the team has used the U-Net convolutional neural network architecture for image segmentation tasks. However, published research has demonstrated that adding residual units to the encoder and decoder paths may improve model performance. Therefore, in this research week I implemented a U-Net architecture inspired by that described by <a href="https://www.mdpi.com/2072-4292/11/15/1774">Zhang et al. (2019)</a> to test whether it would speed up model training or lead to improved performance.</p><p>I added residual blocks to the encoder and decoder paths and then trained and tested the model on the same data as the mangrove project. I only trained these new models for 2 epochs, whereas our original mangrove U-Net model was trained for 200 epochs! The results are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*uR4Twm6hnvmzKk0cQ_flQQ.png" /></figure><p>The addition of the residual units has led to an improvement in model performance for all of the test metrics apart from Precision — and this is only after two epochs — a promising result!</p><p>In our work detecting mangroves, we created a bespoke mangrove labelled data set, whereby each labelled Sentinel 2 image had a corresponding label; in other words, there was a 1:1 relationship between images and labels. After mulling over this relationship and being inspired by Andrew Ng’s discussions around data-centric AI, I decided to experiment with creating a training data set where each label corresponds to more than one image.</p><p>My tested assumption was that mangrove changes over time, but not quickly enough to mean that a label captured at location <em>x</em> and time <em>y</em> would be too incorrect for location <em>x</em> and time <em>z</em> so long as <em>z</em> isn’t too far from <em>y</em>. The addition of more images would hopefully increase the variety of images that the model is trained with, thus improving its ability to generalise to unseen images.</p><p>For each image to label pair in the original labelled data set, I added another image from a different time. Therefore, each label then corresponded to two images both from location <em>x</em>, but time periods <em>y</em> and <em>z</em>. Using the top performing architecture from my first experiment, I trained a new model on this new data set and tested the trained model. Again, I only trained for 2 epochs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*ozagaJVyn-KJAfwfIkiDvQ.png" /></figure><p>The ‘Double Data’ model had led to a significant improvement in quantitative model performance — for example F1 score has increased from 0.72 to 0.79! This is a very exciting result that may allow us to gain greater value from our labelled data sets in the future.</p><h3>Satellite-Derived Bathymetry using Random Forest Regression and Multi Temporal Prediction Aggregation: Rachel Keay</h3><p>The UKHO receives and collects a large quantity of bathymetric data. I used data from a 2018 LiDAR survey over the British Virgin Islands to research and implement satellite-derived bathymetry (SDB) using Sagawa et al’s 2019 methodology from <a href="https://www.mdpi.com/2072-4292/11/10/1155"><em>Satellite Derived Bathymetry using Machine Learning and Multi-Temporal Satellite Images</em></a><em>.</em> This approach overcomes the challenges of image variation in satellite imagery by aggregating the SDB results from each satellite image. They achieved an RSME of 1.41m for depths of 0 to 20m, and I achieved a close result of 1.62m.</p><p>To start, I downloaded nine random European Space Agency Sentinel-2 images using an automated python script with the sentinelsat and sentinelhub APIs. The images had less than 10% cloud cover, and were captured between early 2018 and late 2019. The raw Sentinel-2 SAFE files were atmospherically corrected with the Royal Belgian Institute of Natural Sciences’ <a href="https://odnature.naturalsciences.be/remsem/software-and-data/acolite">ACOLITE tool</a> to output 10m resolution images of reflectance values for the coastal, blue, green, red and near infra-red (NIR) bands. I then used a convolutional approach defined <a href="https://www.sciencedirect.com/science/article/pii/S1077314296900600">by J. Immerkær called <em>Fast Noise Variance Estimation</em></a> to identify the least noisy and glint-free images to take forward for further image pre-processing and machine learning.</p><p>Following the approach in Sagawa et al, I implemented:</p><p>(1) Land, cloud, glint and boat/object masking using NIR band thresholding.</p><p>(2) Deep water masking using the blue and green bands thresholding.</p><p>(3) Machine learning with scikit-learn’s random forest decision tree for regression data. For the random forest I used a typical machine learning approach which included splitting my image into training and testing areas, sampling and balancing my data, and grid search cross validation to find the best hyperparameters for the depth of tree, number of estimators and samples per leaf node.</p><p>(4) And finally, aggregating the predictions with median depth value to get the final SDB data and results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*w7W9a_VR6y0D5QdgTgIBIQ.png" /></figure><p>The aggregated data achieved an average RMSE of 1.62m and R2 of 0.94. The scatter plots of LiDAR bathymetry depth points (x-axis) against SDB (y-axis) show a higher correlation of depth predictions vs true depths below 12.5m, after which the model tends to under-predict.</p><p>The SDB image plot below shows that the training area over Virgin Gorda (the island on the right) has less salt and pepper noise in the predicted bathymetry in comparison to the testing area over East Tortola (the island on the left). This indicates that the model could improve its confidence with more training data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*8t-7djMVD3oSTI6oRpPNIg.png" /><figcaption>Satellite-derived bathymetry results from the method under test.</figcaption></figure><p>My recommendations for further work include improving and conducting further research of deep-water masking techniques, experimentation with other SDB algorithms (e.g. support vector regression and neural networks), and further evaluation of the prediction quality of the model at depth intervals for accuracy reporting to users of SDB data.</p><p>And that’s all for this quarter. I hope you enjoyed this blog and that these insights into our research are interesting and useful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9b81bbd3cfd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-july-2021-research-week-f9b81bbd3cfd">Building Data Science Capability at UKHO: our July 2021 Research Week</a> was originally published in <a href="https://medium.com/uk-hydrographic-office">UK Hydrographic Office</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Data Science Capability at UKHO: our October 2020 Research Week]]></title>
            <link>https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-october-2020-research-week-55a3ed853448?source=rss-f9c6aa918b08------2</link>
            <guid isPermaLink="false">https://medium.com/p/55a3ed853448</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[capability-building]]></category>
            <category><![CDATA[image-segmentation]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Cate Seale]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 14:01:33 GMT</pubDate>
            <atom:updated>2020-12-03T14:01:33.762Z</atom:updated>
            <content:encoded><![CDATA[<h3>Building Data Science capability at the UKHO: our October 2020 Research Week</h3><p><em>This blog was co-authored by Andrew Smith, </em><a href="https://medium.com/@pasc.philipp"><em>Pascal Philipp</em></a><em>, </em><a href="https://datalass1.medium.com/"><em>Rachel Keay</em></a><em>, </em><a href="https://catherineseale.medium.com/"><em>Cate Seale</em></a><em> and </em><a href="https://medium.com/@mike_67820"><em>Mike Hudgell</em></a><em>.</em></p><h3>Using research weeks to push the boundaries of data science at the UKHO</h3><p>Welcome to our quarterly blog post in which we share our ‘<em>research week’ </em>findings, as we explore the interesting bits of data science and machine learning. This month, the team look at reinforcement learning, automate choosing spectral indices, pre-process satellite images, attend a conference and investigate a whole load of useful tools and techniques!</p><h3>What is research week?</h3><p>Members of the Data Science team at the UKHO come up with excellent ideas for how we can apply the latest in machine learning or big data research to the marine data domain. Sometimes these ideas are outside the scope of our current project deliverables, so to push the boundaries of what is possible, every quarter we conduct a ‘<em>research week’</em> — an allocated time for data scientists to experiment with new ideas, techniques and technologies. In this blog we outline our work, how it might tie into our future projects and how the lessons learnt will help with future projects.</p><h4>Initial investigations into reinforcement learning: Andrew Smith</h4><p>Reinforcement learning is a branch of machine learning that involves learning how to take optimal actions through interaction with an environment. An agent observes the current state of an environment (often defined in the form of a Markov Decision Process or MDP), and uses this to determine what action to take. In doing so, a reward is returned that the agent uses to update the best course of action to take in the future (i.e. take more actions that result in a positive reward whilst avoiding actions that result in a negative reward).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K0qGGe72f9_PFRQBuHOqlw.jpeg" /><figcaption>Image credit: <a href="https://www.researchgate.net/figure/Reinforcement-learning-schematic-Reinforcement-learning-RL-can-be-formulated-as-a_fig4_322424392">Galatzer-Levy, Isaac &amp; Ruggles, Kelly &amp; Chen, Zhe. (2018). Data Science in the Research Domain Criteria Era: Relevance of Machine Learning to the Study of Stress Pathology, Recovery, and Resilience. Chronic Stress. 2.</a></figcaption></figure><p>Whilst we have embraced many other branches of machine learning in our work, reinforcement learning has had minimal investigation. Hence, this research week focused on learning more about reinforcement learning with an aim of establishing how it might help with some of our problems.</p><p>Consequently, to keep things as simple as possible (during this learning stage), I explored how reinforcement learning might be useful for tuning of hyper-parameters when training deep learning models. I decided to focus on if it helps when tuning the learning rate within an Adam optimiser. The learning rate seemed like a good candidate for reinforcement learning because the tuning process typically evolves with the number of epochs a deep learning model has trained on, and thus involves a sequence of decision-making that fits in well with the reinforcement learning framework.</p><p>The following images illustrate the set-up for the experiments: <strong>action </strong>is how to change the learning rate (increase, decrease or no change), <strong>state </strong>is based on how the loss value has changed over the last 10 epochs, <strong>reward </strong>is based on if the loss improved, and for the <strong>agent, </strong>Q-Learning was used with an epsilon-greedy policy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8T0u9pBhBIuNb4Qe94vgXw.jpeg" /><figcaption>Image credit: <a href="https://www.researchgate.net/figure/Reinforcement-learning-schematic-Reinforcement-learning-RL-can-be-formulated-as-a_fig4_322424392">Galatzer-Levy, Isaac &amp; Ruggles, Kelly &amp; Chen, Zhe. (2018). Data Science in the Research Domain Criteria Era: Relevance of Machine Learning to the Study of Stress Pathology, Recovery, and Resilience. Chronic Stress. 2</a>, with additional content added by UKHO.</figcaption></figure><p>To evaluate how successfully tuning the learning rate with reinforcement learning worked, a number of commonly used methods for learning rate selection were compared against (e.g. linearly decaying the learning rate). The results suggested that the reinforcement learning approach was as successful as the commonly used methods. Nonetheless, the reinforcement learning set-up is much more complicated than other approaches. Likewise, it has a number of hyper-parameters itself to tune, somewhat making this particular problem redundant. That said, the main aim for this research week was to learn more about reinforcement learning in practice and it has provided many insights into future research directions to which this tool could be applied.</p><h4>Automating the choice of index bands for image segmentation tasks: Pascal Philipp</h4><p>Training an image segmentation model often starts like this:</p><ol><li>We have an array of data of the form (num_images, height, width, num_bands)</li><li>Depending on the task, we often add a suitable index band (e.g. the <a href="https://en.wikipedia.org/wiki/Normalized_difference_water_index">normalised difference water index</a> or the<a href="https://en.wikipedia.org/wiki/Normalized_difference_vegetation_index"> normalised difference vegetation index</a>). The index band is a combination of the bands in the original data block and is appended to it, giving data of the form (num_images, height, width, num_bands + 1).</li><li>This is then fed into a machine learning algorithm</li></ol><p>The choice in step 2 requires experience/research/experimentation and may not be the best solution — wouldn’t it be better if the ML model could learn which index band to use? The aim of this research week project is to explore this option.</p><p><strong>Modelling</strong></p><p>We generalise step 2 by letting the index band be of the form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*a5-I3v4uGpIVWFmnp81z-A.jpeg" /><figcaption>Image credit: UK Hydrographic Office © Crown copyright 2020 UK Hydrographic Office</figcaption></figure><p>This takes place inside a custom layer called IndexFinder, which takes the data with num_bands bands and produces data with num_bands + 1 bands. This is then fed into the ML architecture that would otherwise have received the data block with the handpicked index band from step 2 above. The parameters ai, bi are initialised randomly and trained just like all the other weights. The pre-defined water and vegetation index bands mentioned above have</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*pag2akLherhr_91rrQIaJA.jpeg" /><figcaption>Image credit: UK Hydrographic Office © Crown copyright 2020 UK Hydrographic Office</figcaption></figure><p>for some combinations i,j. Can our IndexFinder learn those configurations or find better ones?</p><p><strong>Results</strong></p><p>Training the IndexFinder layer at the same time as the rest of the model requires callbacks to control the training, as otherwise the small number of weights in the IndexFinder layer wouldn’t get enough attention among the thousands or millions of weights in the rest of the model. For example, we can freeze all but the IndexFinder layer for certain epochs. That worked, but despite the callbacks, I didn’t see much change in the way the new index band is computed. An interpretation of that could be that letting the model find a suitable index band at the same time as letting it learn to work with that index band is asking too much.</p><p>Another experiment to try to get more action in the IndexFinder layer was to work with a fixed model that has been trained to work for a handpicked index band. Instead of feeding that index band into the model, let IndexFinder find it. Does that work? Well, we’re not getting the clean parameters (2) above, but there’s definitely more going on now in the IndexFinder layer. Here are some results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glCR2NKhZET-MetOry4NUw.jpeg" /><figcaption>Image credit: UK Hydrographic Office © Crown copyright 2020 UK Hydrographic Office</figcaption></figure><p>On the left, we have the original image; then the true labels (here: water and land); then two different types of normalised difference water indices which one may use as in step 2 above; then the index band that is added by IndexFinder: before training (random initialisation) and after training!</p><p><strong>Conclusion</strong></p><p>This was a fun project, a good opportunity to dig in a little deeper and implement custom layers and custom callbacks in Keras. Performance of different experiments wasn’t assessed much — the focus was more on technical capabilities — and I don’t have any results like “the IndexFinder layer improves performance”, but the option to find and use a custom index band is nevertheless something I’ll keep in mind.</p><h4>Atmospheric and glint correction of Sentinel-2 imagery for marine and coastal machine learning: Rachel Keay</h4><p><em>Rachel has written </em><a href="https://medium.com/uk-hydrographic-office/atmospheric-and-glint-correction-of-sentinel-2-imagery-for-marine-and-coastal-machine-learning-ec0ea8734e23"><em>a separate blog post</em></a><em> on her research week.</em></p><h4>Notes from the IEEE International Geoscience And Remote Sensing Symposium 2020: Cate Seale</h4><p>For my research week I attended <a href="https://igarss2020.org/">IGARSS 2020</a> which had a packed technical program of remote sensing, satellites and machine learning. Whilst I was sad not to be learning about these topics from a beach in Hawaii (original location <a href="https://www.google.com/maps/place/19%C2%B055&#39;28.4%22N+155%C2%B053&#39;14.8%22W/@19.9245663,-155.8879805,247m/data=!3m2!1e3!4b1!4m6!3m5!1s0x0:0x0!7e2!8m2!3d19.9245646!4d-155.887432?hl=en">Waikoloa</a>), I was excited to see the latest research.</p><p>From the start of the first UK lockdown in March, I have attended numerous webinars, workshops and working groups that were held remotely (I’m sure many others have had a similar experience). This was the first time I’d attempted a week-long conference with a full day’s agenda, and as expected, some things were good, and some not-so-good…</p><p>On the one hand:</p><ul><li>I went to a conference (for $10!) that would have been prohibitively expensive otherwise.</li><li>It’s super easy to type a question in the chat and have it answered, in comparison to sticking your hand up in a full auditorium and/or standing up to speak into a microphone.</li><li>Attending conferences in person with a physical body limits you to attending one track at a time and inevitably there were 10+ sessions running concurrently. Here, the poster presentations were prerecorded videos, with the authors available to ask questions after broadcast, and slides and video available for download. Very useful if you get FOMO.</li><li>I avoided the environmental impact of travel, had no jet-lag or hotel costs — multiple wins here!</li><li>I was able duck out of a session without doing a walk of shame. 😊</li></ul><p>On the other hand:</p><ul><li>It’s so easy to get distracted by work and home life when you aren’t physically removed from it all, so conferencing ends up <em>adding </em>to your mental load.</li><li>Getting the information is only achieved when the presenter is understandable, but not all microphones are equal! Presenters ranged from crisp and clear to seemingly recorded-underwater-next-to-pneumatic-drill. Not really anyone’s fault, but unfortunately degraded the experience.</li><li>I personally didn’t get along with the use of text-to-speech software and found it hard to concentrate (my brain obviously switches off when it hears computer-voice), but appreciate this may be preferable for speakers that were confident in English.</li><li>There was no networking, and I really missed the opportunity to talk to people.</li></ul><p>Overall, it was a positive experience and my respect and admiration go out to the organisers for the smooth coordination of hundreds of speakers and thousands of attendees. The technology needed to run an event like this remotely seems intimidating at best, but (barring the odd terrible microphone) everything went well, and I appreciated being able to continue to attend conferences and training courses while COVID rages outside my door.</p><h4>Investigation of tools and techniques: Mike Hudgell</h4><p><strong>Moving window technique</strong></p><p>We have written a geomorphology function that classifies pixels of a bathymetric surface into 10 canonical forms, namely: flat, summit, ridge, shoulder, spur, slope, hollow, foot-slope, valley, depression. The function is smart in that you can have different focal ranges and thresholds to suit your use-case, and is proving useful in our current work with LIDAR imagery and seagrass detection. However, the function is slow as it needs to calculate the slope at eight compass points for every pixel. Therefore, the investigation was to see if we could improve the performance of the function by using a DASK moving window technique.</p><p>The “moving window” technique essentially splits the raster into many thousands of windows (with overlaps so you don’t get any unwanted edge artefacts) and processes the windows in parallel. We achieved the following results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tNQDDn4d08dFQl554qlRNA.png" /><figcaption>Image credit: UK Hydrographic Office © Crown copyright 2020 UK Hydrographic Office</figcaption></figure><p>So, this was a successful experiment showing an 82% improvement in performance was possible and one that will be worth factoring into the development of our functions going forwards. However, it is worth observing:</p><ul><li>we saw a 35% performance improvement by running the baseline code on a higher spec machine, without adding complexity to the code.</li><li>we saw a 44% and 72% performance improvement (business and experimental laptops respectively) with DASK, indicating that if we go to the trouble of parallelising our functions, we will gain most benefit on higher spec machines.</li></ul><p><strong>RAPIDS</strong></p><p>We have started to use a new library called <a href="https://rapids.ai/">RAPIDS </a>that enables us to run many different data science algorithms on GPU rather than CPU which has the potential not just to save us time but also make some algorithms viable — as sometimes the algorithm we really want to use can be just too slow.</p><p>Two experiments were carried out, timing k-means clustering and loading a data frame:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6K33fv3q9kYR_di0TlQOZA.png" /><figcaption>Image credit: UK Hydrographic Office © Crown copyright 2020 UK Hydrographic Office</figcaption></figure><p>So, these experiments were successful in showing improvements in performance and an early indication that we are likely to want to exploit GPUs more than we do currently.</p><p><strong>Additional techniques</strong></p><p>Finally, I spent time reading around various techniques that we think are going to be useful, namely: Morphological Building Index; Morphological Shadow index; Bathymetric Position Index; Topographic Position Index.</p><p>Here is an example synthetic surface we have created from an aerial image using the Morphological Building Index algorithm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*lj2S2Gi8zvqsK9cF4ejvOg.jpeg" /><figcaption>Image credit: UK Hydrographic Office © Crown copyright 2020 UK Hydrographic Office</figcaption></figure><h3>Conclusions</h3><p>Thanks to all of our contributors this month! Developing new techniques to solve complex problems is an important part of being a data scientist, as off-the-shelf algorithms and techniques only get you so far when it comes to solving new data problems.</p><p>Knowing where and how to spend time developing new approaches can be difficult, especially when deadlines are looming. But, by protecting time each quarter for our data scientists to explore new ideas and techniques without the pressure of immediate project deliverables, we’ve found that our understanding of complex problems has increased, our delivered solutions have improved, and the overall skill and knowledge level of our team has increased.</p><p>We’d recommend the approach is taken up by other data science teams — no matter your domain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55a3ed853448" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uk-hydrographic-office/building-data-science-capability-at-ukho-our-october-2020-research-week-55a3ed853448">Building Data Science Capability at UKHO: our October 2020 Research Week</a> was originally published in <a href="https://medium.com/uk-hydrographic-office">UK Hydrographic Office</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Notes from my studies: Recurrent Neural Networks and Long Short-Term Memory]]></title>
            <link>https://catherineseale.medium.com/notes-from-my-studies-recurrent-neural-networks-and-long-short-term-memory-a0f35205f654?source=rss-f9c6aa918b08------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0f35205f654</guid>
            <category><![CDATA[recurrent-neural-network]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Cate Seale]]></dc:creator>
            <pubDate>Mon, 09 Nov 2020 07:30:18 GMT</pubDate>
            <atom:updated>2020-11-09T07:30:18.953Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This post contains notes from my studies. It’s mostly to keep them where I can find them, but if someone else finds them useful, that’s good too ☺️.</em></p><p>Before we kick off, here’s what I look like to trying to fix LaTeX when it’s pasted into Medium:</p><figure><img alt="Not an actual photo of me studying, but a picture of a girl with her head in a book." src="https://cdn-images-1.medium.com/max/1024/0*K7vbBs0diufDhlCp" /><figcaption>Photo by <a href="https://unsplash.com/@siora18?utm_source=medium&amp;utm_medium=referral">Siora Photography</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Back in June 2019 I wrote a 10 page report on the inner workings of recurrent neural networks and long-short term memory units. Not as fun as implementing them, but useful nonetheless!</p><p><strong>Background</strong></p><p>An artificial neural network (ANN) is a network of interconnected algorithms used in machine learning to recognise patterns in data. Neural networks learn in a supervised way — they ’learn’ patterns from training samples and are able to perform predictive tasks such as classification or regression.</p><p>The basic neural network architecture is the feedforward neural network. The data moves forward through the network, starting at an input layer, through any hidden layers, to an output layer. Here, we will focus on a variant to this basic structure called Recurrent Neural Networks (RNNs), which introduces a feedback loop to allow the output of the network to be fed back into the network as a new input.</p><p>The addition of a feedback loop allows the network to process, learn and predict sequential data. Traditional feedforward networks cannot do this because inputs and outputs to these networks are vectors of fixed size, assumed to be independent from each other. For example, if you train a network to recognise images of cats and dogs, and use it to classify ten images, the prediction for each image is not affected by the outcome for the previous, or any other, image. Sequential data is different; it can vary in length and the values are not independent, the data points are related to the data that has come before them.</p><p>With the feedback loop modification, RNNs can process every element in a sequence in turn and persist information added by each element. This gives RNNs the capability to handle temporal dependancies, and so can process sequences of vectors of variable length as both input and output, to perform such tasks as:</p><ul><li>Predicting the next word in a sentence.</li><li>Music composition.</li><li>Stock market prediction.</li><li>Signal processing.</li><li>Time series anomaly detection.</li><li>Handwriting and speech recognition.</li></ul><p>Prior to the advent of RNNs, solving predictive tasks relating to sequential data was achieved with methods such as Hidden Markov Models (HMM). HMMs assign each element in a sequence a class, and compute probabilities that the next item in a sequence will be that class, then will select the most likely class as its prediction. Although HMMs are fast and efficient on shorter sequences, to achieve high accuracy on complex sequences (where a value is dependent on values many places behind it) they become exponentially expensive, and are outperformed by RNNs on these complex tasks [1].</p><p>The foundation for RNNs was led by research in the 1980’s, with ‘Hopfield networks’ — a type of network with a memory [2]. RNNs saw significant improvement in the 1990’s with the invention of Long Short-Term Memory (LSTMs) RNNs [3], which solved a major issue with standard RNNs, the vanishing/exploding gradient problem, discussed in the following section. A further development to the LSTM architecture was presented by Cho, et al. in 1994, the Gated Recurrent Unit (GRU) [4], also discussed below.</p><p>Today, RNNs in various forms are present in many household applications. Google’s Voice Search uses RNNs [5], the Apple personal assistant Siri uses GRUs in its speech synthesis [6] and the language translation abilities of Google Translate were improved in 2016 using a deep LSTM network [7].</p><p><strong>Standard Recurrent Neural Networks</strong></p><p>RNNs replace the hidden layer in a regular neural network with a recurrent layer (or layers), which introduce the propagation of data back into the network at each time step. The network state and output at each time step is therefore dependant on the previous time step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ONCeTPf1WpgpEQ1l21vtww.png" /><figcaption><em>Layers in a regular neural network (left) and a recurrent neural network (right).</em></figcaption></figure><p>Recurrent neural networks process a sequence of values <em>u</em>₁, . . . , <em>uτ </em>with time step index <em>t </em>ranging from 1 to <em>τ</em>. Given an input vector <em>ut </em>and a neural network state <em>xt</em>, an output vector <em>zt </em>is produced at each time step <em>t.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OIgPli6Zz7zfTsEN2q3ETA.png" /><figcaption><em>Recurrent neural network architecture.</em></figcaption></figure><p>The current state of the neural network is dependant on the previous state and the current input, given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*9f_vAvcZUjQOIh1nhdm1IQ.png" /></figure><p>Where:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nKsab1T5WDCy0aOm93hV0A.png" /></figure><p>It follows that the output <em>zt </em>is not only dependant on the input, but the current state of the network, and therefore is also influenced by all previous inputs. A parametric function <em>f ( . ) </em>represents output layer computation, for a classification task this could be softmax, and for regression tasks this could be L2 norm squared error:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*4EPMCDAbeUnUyQ0FEViMqQ.png" /></figure><p>where <em>Wo </em>are the output layer weights.</p><p>The figure below shows an example of an RNN with one hidden layer that has been ‘unrolled’, illustrating the specific inputs and outputs at each time step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m-GWIx2PnK7hcEeJdlbF0A.png" /><figcaption><em>Diagram of an ‘unrolled’ RNN.</em></figcaption></figure><p><strong>Training an RNN</strong></p><p>During training, the network is fed training samples, and produces a predicted output <em>zt</em>′ at each time step. In order to optimise the network, the back-propagation training algorithm is used.</p><p>During back-propagation, the error or ‘loss’ (the difference between predicted output <em>zt</em>′ with the target output from the training data <em>zt</em>) is measured using a loss function. The amount of contribution to this error that occurs at the final time step is calculated. Then the contribution from the layer before that and so on, until the input layer is reached. The propagation of the error backwards through the network allows the algorithm to measure the error gradient across all the network connections. Once the error gradients are known, gradient descent is used to tweak the weights and biases within the network so as to reduce the error. The training and updating of weights and biases continues to repeat, with the goal of learning the correct weights and biases to correctly predict the target output.</p><p><strong>Back-propagation through time.</strong></p><p>Unlike traditional ANNs which use separate weights for each hidden layer, RNNs share the weights across each time step — if the network is unrolled through time, it can be considered to have a separate layer at each time step, all sharing the same weight matrix. As the weights are shared across each time step, the gradient of the error at each step is dependant on the loss at all previous steps. For example, to calculate the gradient at step five, the gradients of the previous four steps are summed together with the gradient at step five. This is known as back propagation through time or BPTT.</p><p><strong>Issues with RNNs: Vanishing and Exploding Gradient Problems</strong></p><p>When summing the contributions of each time step to the gradient during BPTT, particularly for long sequences, the gradient values can suffer from the Vanishing Gradient Problem. This occurs if some of the weights are small; when summing, the subsequent gradient will keep on getting smaller and tend to ~0, or ‘vanish’. This is a problem because gradients are used during training to update the network parameters, so, as the gradient lowers, the parameter updates become insignificant and the network does not learn. This is not an issue for standard ANNs, as they don’t share parameters across the layers and no summing is necessary.</p><p>Similarly, if the weights are large then the final value would approach infinity, known as an Exploding Gradient. A simple and effective solution to the exploding gradient problem is to set a threshold to ‘clip’ the gradient value if it is too large. Countering the vanishing gradient problem is more difficult. One solution is to use the ReLU activation function in place of tanh or sigmoid activation functions, as the ReLU derivative is either 0 or 1 and so a vanishing gradient is less likely. Alternatively, a variation on standard RNNs called Long Short-Term Memory networks was developed specifically to address this problem.</p><p><strong>Long Short-Term Memory Networks</strong></p><p>Long Short-Term Memory (LSTM) networks, first proposed in 1997 by Hochreiter and Schmidhuber, advanced RNNs by addressing the Vanishing Gradient Problem [3] and are now commonly used. The structure of LSTMs is similar to a vanilla RNN, but replace the function that computes the hidden state with a <em>cell. </em>Cells accept as input the previous state <em>xt</em>−1 and the current data value <em>ut </em>and have the ability to keep or remove information to the state through the use of <em>gates</em>.</p><p>The standard RNN hidden layer is simple, such as a tanh layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SPBfCy6Tc2cickrh1mh9cg.png" /><figcaption><em>Architecture of a standard RNN.</em></figcaption></figure><p>The recurrent layer in LSTM adds three sigmoid layers, termed ‘gates’. One to control what information is forgotten, the forget gate <em>f</em>, one to control which values to update, the input gate <em>i</em>, and a final layer that creates a new vector of candidate values that could be added to the state, the output gate <em>o.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mxImyWlmrXdJspZJSqSqIw.png" /><figcaption><em>Architecture of a LSTM network.</em></figcaption></figure><p>Each of these gates is a sigmoid neural net layer that outputs values between 0 and 1, controlling how much information should be passed through the gate. A value of 0 does not let any information pass, and a value of 1 lets all information pass when multiplying element-wise with another vector.</p><p>In order to update the cell state in a standard RNN, we use the following equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*DD5d-4sXTjvXRk4UuPiO7g.png" /></figure><p>In order to update the cell state in LSTM, first the forget gate is used to decide what information to discard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*HONV_pxqwIj6ighio7DXAA.png" /></figure><p>Where <em>ft </em>is the output of the forget gate, <em>Wf </em>is a weight matrix, <em>zt</em>−1 is the previous output, <em>ut </em>is the current input and <em>bf </em>is a bias vector. <em>ft </em>is comprised of a value between 0 and 1 for every value in the previous cell state <em>xt</em>−1, to control what to discard from the cell state. Next, there is a two part operation to decide what new information to add into the cell state. Firstly, the input gate decides which values in the cell state to update:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*zdQzOpSXaMg6nfRxwsAtAw.png" /></figure><p>Where <em>it </em>is the output of the input gate, <em>Wi </em>is a weight matrix and <em>bi </em>is a bias vector. Secondly, a tanh layer creates new values that could be added to the cell state:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*v-9LgehryemZaN9x773bMA.png" /></figure><p>Where <em>x</em> ̃ is the output of the tanh layer, <em>W </em>is a weight matrix and <em>b </em>is a bias vector. Now it is possible to update the cell state using a combination of the outputs from the input gate, forget gate and tanh layer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*lJeGE9q1m31qPHWm0PJw6A.png" /></figure><p>The previous state is multiplied by the output from the forget gate, to discard information. The new values to be added are scaled using the output from the input gate and added to the previous state, resulting in the new cell state <em>xt</em>. Now the cell state has been updated, the output from the network can be calculated. This is controlled by the output gate and another tanh layer. The output gate is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*JcahlD_eXFUqNzyzLt8hQQ.png" /></figure><p>Giving the final output from the network <em>zt </em>as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*ZWhydd72ZTCLyjRHYQOEsw.png" /></figure><p>The vanishing gradient problem is no longer an issue when back-propagating errors through time in LSTM networks. During back propagation, if the derivative of the output ∂<em>xt </em>is starting to converge to 0, the values of the forget gate can increase, preventing ∂<em>xt</em>−1 the gradients from from vanishing. As the values of <em>f</em>, <em>o</em>, <em>i </em>and <em>x</em> ̃ are learnt by the network, the network can decide when to let the gradient vanish and when not to do so. It does not matter how long the sequence is, the network has a mechanism for information not to be forgotten, and longer term dependences can be modelled.</p><p><strong>Gated Recurrent Units</strong></p><p>A popular variant on the LSTM network called the Gated Recurrent Unit (GRU) was introduced by Cho, et al. in 2014 [4]. GRU cells are simplified versions of the LSTM cell, but have comparable performance.</p><p>A GRU has two gates, a reset gate and an update gate, which are very similar to the gates in LSTM. The update gate is a combination of LSTM’s input and forget gates, and decides how much of the previous cell state to persist. The reset gate, that decides how to combine the new data, is applied directly to the previous state.</p><p><strong>Applications of Recurrent Neural Networks</strong></p><p>It has been shown that RNNs and variants are well suited to processing sequential data, and one such application is the translation of video data into a semantic description of its contents.</p><p>The classification of images and videos is a fundamental challenge in the field of computer vision. Convolutional neural networks (CNNs) have achieved state of the art performance on image classification and when used in combination with RNNs, the task of providing video descriptions using neural networks has seen significant progress.</p><p>A neural network based approach to this task was described by Venugopalan, et al. [8]. They posit that by using a CNN to label individual video frames, the output from the CNN can be used as input to an LSTM to generate a sentence describing the activity in the video, the architecture they developed is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCIrykL_ta3q-nLwaUqSew.png" /><figcaption><em>The video description network architecture. Features are extracted for each frame, mean pooled across the video, and inputted to the LSTM network at each time step. The LSTM outputs one word at each time step, based on the video features (and the previous word) until it picks an end-of-sentence tag.</em></figcaption></figure><p>Several CNN-LSTM architectures were trained and evaluated on a dataset of over 1970 videos depicting an activity, with human-generated descriptions. Experiments found that a model pre-trained on large image datasets (of which there are more available than labelled video datasets) and then using transfer learning to train on video datasets performed better compared to model trained only on video descriptions.</p><p>Further work on automated video descriptions is being undertaken. An end-to- end network for activity recognition and video description was proposed by Donahue, et al. in 2016 [9] also used a CNN-LSTM combination, and RNN-based solutions remain a popular approach to this problem [10].</p><p><strong>References</strong></p><ol><li>Kostadinov, S., Recurrent Neural Networks with Python Quick Start Guide. 2018: Packt Publishing.</li><li>Hopfield, J., <em>Neural networks and physical systems with emergent collective computa- tional abilities. </em>Proceedings of the National Academy of Sciences of the United States of America, 1982. <strong>79</strong>: p. 2554–2558.</li><li>Hochreiter, S. and J. Schmidhuber, <em>Long Short-Term Memory. </em>Neural Computation, 1997. <strong>9</strong>(8): p. 1735–1790.</li><li>Cho, K., et al., Learning Phrase Representations using RNN Encoder–Decoder for Stat- istical Machine Translation. Proc. Conference on Empirical Methods in Natural Language Processing, 2014: p. 1724–1734.</li><li>He, Y., et al., Streaming End-to-end Speech Recognition For Mobile Devices. arXiv e- prints, 2018: p. arXiv:1811.06621.</li><li>Capes, T., et al., Siri On-Device Deep Learning-Guided Unit Selection Text-to-Speech System, in Interspeech 2017. 2017, Apple, Inc. p. 4011–4015.</li><li>Wu, Y., et al., Google’s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation. arXiv e-prints, 2016: p. arXiv:1609.08144.</li><li>Venugopalan, S., et al., Translating Videos to Natural Language Using Deep Recurrent Neural Networks, in Human Language Technologies: The 2015 Annual Conference of the North American Chapter of the ACL. 2015, Association for Computational Linguistics: Denver, Color- ado. p. 1494–1504.</li><li>Donahue, J., et al., Long-term Recurrent Convolutional Networks for Visual Recognition and Description. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2016. <strong>39</strong>(4): p. 677–691.</li><li>Laokulrat, N., et al. Generating Video Description using Sequence-to-sequence Model with Temporal Attention. in COLING 2016, the 26th International Conference on Computational Linguistics. 2016. Osaka, Japan.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0f35205f654" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mapping the world’s coastlines with satellite imagery — Part II]]></title>
            <link>https://medium.com/uk-hydrographic-office/mapping-the-worlds-coastlines-with-satellite-imagery-part-ii-5ee01d3034b7?source=rss-f9c6aa918b08------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ee01d3034b7</guid>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[mapping]]></category>
            <category><![CDATA[satellite]]></category>
            <category><![CDATA[coastline]]></category>
            <category><![CDATA[marine-data]]></category>
            <dc:creator><![CDATA[Cate Seale]]></dc:creator>
            <pubDate>Tue, 11 Aug 2020 10:02:54 GMT</pubDate>
            <atom:updated>2020-08-12T08:21:44.625Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mapping the world’s coastlines with satellite imagery — Part II</h3><p><em>Part I of this blog series is </em><a href="https://medium.com/uk-hydrographic-office/mapping-the-worlds-coastlines-with-satellite-imagery-part-i-296fa5f2985b"><em>here</em></a><em>.</em></p><p>At the UKHO we are interested in the oceans, the seabed and the coastline — not to mention everything in and on them! In our previous blog, we (the UKHO Data Science team) outlined our quest to automate mapping of the world’s coastlines.</p><p>From that work, a satellite-derived coastline for the British Isles was created, available for free on the <a href="https://datahub.admiralty.co.uk/portal/apps/sites/#/marine-data-portal/items?tags=V2">ADMIRALTY Marine Data Portal</a>. Since then we have come across use cases for this data on an almost-daily basis, and the feedback we have received can be summarised into three main themes:</p><ul><li><strong>Can I get satellite-derived coastline data for my local beach/town/country?</strong></li><li><strong>Does the data show mean sea level?</strong></li><li><strong>Can you capture coastline at high tide and low tide?</strong></li></ul><p>The answers at the time were maybe, no and maybe, which definitely wasn’t good enough! The feedback themes helped us redefine our approach to continued research and development on this project. In this article, I will describe the progress we have made as we iterate, and hopefully show how we’ve answered (or will answer) these questions.</p><h3>Some background</h3><p>Initially we created a yearly, median pixel mosaic of Sentinel-2 satellite images and used this as a base to extract one representative coastline. This worked well, and was a useful thing, however, deriving coastline in this way has some pros and cons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UwDDvPAmqt8X-bT-hhc1g.png" /><figcaption><strong><em>Satellite-derived Coastline for the British Isles. </em></strong><em>UK Hydrographic Office © Crown Copyright 2020. Created using Google Earth Engine.</em></figcaption></figure><ul><li><strong>Pro</strong>. Averaged mosaics take care of a large amount of the variation intrinsic in satellite imagery — clouds, shadows, saturated pixels and so on. This makes classification a lot easier.</li><li><strong>Pro</strong>. You can create a mosaic as large as you want, removing the need to deal with the edges of images, and how to ‘bridge’ data over those edges.</li><li><strong>Con</strong>. The chance of assigning a vertical datum (such as mean sea level) to the data is lost in the averaging process used to create the mosaic. The median pixel is chosen in all areas, so the final image is a composite of thousands of images, all taken at different states of tide.</li><li><strong>Con</strong>. There is no way of knowing what the tidal state was when any of the images were taken, either by looking at an image or it’s metadata.</li></ul><p>To identify which areas of the mosaic are water and which are land (i.e. to perform image segmentation), we calculate the <a href="https://en.wikipedia.org/wiki/Normalized_difference_water_index">Normalised Difference Water Index’ (NDWI)</a> and define a local threshold using <a href="http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html">Otsu’s Method</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oBUh6xg01KRb37X2t31XjQ.png" /><figcaption><strong><em>A Sentinel-2 image (left), image NDWI (middle) and the binary image after thresholding (right). </em></strong><em>UK Hydrographic Office © Crown Copyright 2019. Created using Google Earth Engine. Copernicus Sentinel data 2020.</em></figcaption></figure><p>Again, this has some pros and cons.</p><ul><li><strong>Pro</strong>. Unsupervised classification is quick, easy to understand and simple to implement.</li><li><strong>Pro</strong>. Works very well most of the time.</li><li><strong>Con</strong>. Built-up areas and (exposed) intertidal zones have NDWI values that are very close to water, resulting in misclassifications.</li><li><strong>Con</strong>. Even with Otsu’s method, it’s hard to pick a threshold in an automated way, particularly if there is an imbalanced ratio of land and water pixels.</li><li><strong>Con.</strong> The classification method is not robust enough to deploy anywhere in the world without significant manual intervention.</li></ul><h3>The task</h3><p>Assigning tidal information to satellite images has been successfully demonstrated by <a href="https://www.linkedin.com/in/robbibt/">Robbi Bishop-Taylor</a>, Stephen Sagar and colleagues at Geoscience Australia in their work <a href="https://www.sciencedirect.com/science/article/pii/S0272771418308783">modelling the intertidal zones of Australia</a>. Satellite images can be attributed with a predicted tide height using the time, date and location of the images to query a global, gridded tidal model. Then, by deriving coastline over a long time-series of imagery the generated coastline vectors can be labelled with a predicted tidal height, resulting in a picture of the intertidal zone emerging <em>and</em> an estimate of the coastline’s position relative to mean sea level.</p><p>To choose a tidal model (there are a number of options out there, including <a href="https://www.tpxo.net/global/tpxo9-atlas">TPXO9-atlas</a>, <a href="https://www.aviso.altimetry.fr/en/data/products/auxiliary-products/global-tide-fes.html">FES2014</a> and <a href="https://www.space.dtu.dk/english/research/scientific_data_and_models/global_ocean_tide_model">DTU10</a>) we teamed up with Chris Jones and <a href="https://www.linkedin.com/in/colin-shepherd-23464a47/">Colin Shepherd</a> from the UKHO Tides Team to assess various models against our own <a href="https://www.admiralty.co.uk/digital-services/admiralty-digital-publications/admiralty-totaltide">ADMIRALTY TotalTide software</a>. ADMIRALTY TotalTide can be used to predict tidal heights and tidal streams at the locations of over 7,000 tidal stations, distributed globally (7,433 at the time of writing). All of these tidal stations will have been visited in order to measure in situ observations of sea level, which are then subsequently analysed to derive the necessary underlying data (i.e. the harmonic constituents and/or time and height differences from a reference port) in order to compute a predicted tidal curve.</p><p>We <em>could</em> use ADMIRALTY TotalTide to provide the satellite image tide predictions, however using a gridded, global model is preferential for our purposes to obtaining estimates using in situ stations because:</p><ul><li>In-situ <strong>observed </strong>data may not be available at the specific location of the satellite images, thus the ‘next best thing’ is a tidal prediction.</li><li>There may also be a lack of ‘traditional’ tidal <strong>prediction </strong>stations available in the region, thus relying on tidal stations potentially quite distant from the required area (and therefore potentially unsuitable).</li><li>A tidal model (once validated and assured that the predictions are suitable) offers ‘seamless’ tidal predictions over the required region on a regularly gridded scale.</li></ul><p>Assessing the tidal models against a number of metrics (these included root mean square error comparison with ADMIRALTY TotalTide, number of harmonics, ease of automation, resolution and others) concluded that FES2014 performed best in our tests. FES is available after registration on the <a href="https://www.aviso.altimetry.fr/es/data/products/auxiliary-products/global-tide-fes/description-fes2014.html">CNE</a>S data centre website, and comes with a handy <a href="https://bitbucket.org/cnes_aviso/fes/src/master/">Python package</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*Rp3Gj1f44iTnD-9HqStxIg.png" /><figcaption><strong><em>Tidal predictions at Station 2940 (Eastern edge of Nova Scotia, outside Bay of Fundy) for March 2011 at 15-minute intervals.</em></strong></figcaption></figure><p>In order to maximise the chance of getting a satellite image where the tide is at all the different stages in its range, we grab all the imagery for an area from Landsat 7, Landsat 8 and Sentinel-2 satellites (available in <a href="https://developers.google.com/earth-engine/datasets/catalog/sentinel/">Earth Engine</a>), which returns a 20 year time series. Coastline is detected on each of these images using our original classifier and, following the methodology of <a href="https://www.sciencedirect.com/science/article/pii/S0272771418308783">Bishop-Taylor et. al</a>., we derive 10 coastline contours, covering the intertidal range visible on the satellite image series, and attributed with their height relative to mean sea level.</p><h3>Results</h3><p>Here are some of the results, overlaid on ADMIRALTY charts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9EGONBsuhblFhe4s-roF1g.png" /><figcaption><strong><em>St. Michael’s Mount, Cornwall, UK. </em></strong><em>UK Hydrographic Office © Crown Copyright 2020. Created using Google Earth Engine. Background © Crown Copyright and/or database rights. UK Hydrographic Office (</em><a href="http://www.gov.uk/UKHO)"><em>www.GOV.uk/UKHO)</em></a><em>.</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aVeWEWcklKRX30XoJWjVjA.png" /><figcaption><strong><em>Portsmouth Harbour, UK. </em></strong><em>UK Hydrographic Office © Crown Copyright 2020. Created using Google Earth Engine. Background © Crown Copyright and/or database rights. UK Hydrographic Office (</em><a href="http://www.gov.uk/UKHO"><em>www.GOV.uk/UKHO).</em></a></figcaption></figure><p>These data samples are available for free on the <a href="https://datahub.admiralty.co.uk/portal/apps/sites/#/marine-data-portal/items?tags=V2">ADMIRALTY Marine Data Portal</a>.</p><p>To conclude, out of the two tasks identified, we have now integrated tidal information into the coastline-derivation process and can answer two of the three questions:</p><ul><li><strong>Does the data show mean sea level?</strong> YES — coastlines are attributed with estimated height relative to mean sea level.</li><li><strong>Can you classify coastline at high tide and low tide?</strong> YES — if it has been captured on satellite imagery in the past 20 years, we can classify it.</li><li><strong>Will this work for my local beach/town/country?</strong> We are working on it now 😊</li></ul><h3>So, what’s next?</h3><p>Up next is the creation of a <em>geo-generalised </em>and <em>temporally-generalised </em>model that performs well on coastlines all around the globe. We have been working for a few months on gathering training data and developing a deep neural network to classify images that will plug into the pipeline, replacing the original classifier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*sNAEk64nfBxcAf4MCvByoA.png" /><figcaption><strong><em>Lyttelton Harbour, near Christchurch, New Zealand. </em></strong><em>UK Hydrographic Office © Crown Copyright 2019. Created using Google Earth Engine. Copernicus Sentinel data 2020.</em></figcaption></figure><p>This work is part of a wider venture into detection of marine and coastal features visible on satellite imagery, such as <a href="https://medium.com/uk-hydrographic-office/scaling-machine-learning-models-across-the-globe-the-quest-for-geo-generalisability-in-mangrove-f14282738378">mangrove forests</a>, kelp and seagrass. We’ve found there are commonalities in these image segmentation tasks, such as the <a href="https://medium.com/uk-hydrographic-office/getting-to-the-truth-of-your-labels-how-to-be-confident-in-the-absence-of-ground-truth-data-db7e770eb562">difficulty in creating training data</a> for remote sensing data.</p><p>Part III (the classifier strikes back) coming soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ee01d3034b7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uk-hydrographic-office/mapping-the-worlds-coastlines-with-satellite-imagery-part-ii-5ee01d3034b7">Mapping the world’s coastlines with satellite imagery — Part II</a> was originally published in <a href="https://medium.com/uk-hydrographic-office">UK Hydrographic Office</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mapping the world’s coastlines with satellite imagery — Part I]]></title>
            <link>https://medium.com/uk-hydrographic-office/mapping-the-worlds-coastlines-with-satellite-imagery-part-i-296fa5f2985b?source=rss-f9c6aa918b08------2</link>
            <guid isPermaLink="false">https://medium.com/p/296fa5f2985b</guid>
            <category><![CDATA[dataset]]></category>
            <category><![CDATA[marine-data]]></category>
            <category><![CDATA[satellite-imagery]]></category>
            <category><![CDATA[coastline]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Cate Seale]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 12:35:27 GMT</pubDate>
            <atom:updated>2020-07-21T12:35:27.559Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mapping the world’s coastlines with satellite imagery — Part I</h3><p>At the UKHO, we use data science to gain valuable insight into the data sets we hold and further our understanding of the marine environment around us.</p><p>One of our latest projects combines satellite imagery and computer vision techniques to enable us to automate the creation of new coastline data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*pL-WilVMmO1SszGU65IciA.jpeg" /></figure><h3><strong>A new coastline data set</strong></h3><p>Automating the creation of coastline data was important to us for a variety of reasons. Firstly, we wanted to form the basis for performing global change detection. For us, this would help us to be more proactive in updating our portfolio of navigational charts.</p><p>Beyond navigation, this data could also help to support other activities carried out by customers and partners, including:</p><ul><li>Monitoring the natural environment (including erosion, sedimentation, subsidence etc.)</li><li>Developing tidal and coastal models (including currents, tides and ocean modelling)</li><li>Supporting disaster resilience</li></ul><p>And finally, this would be a first step for us in producing much higher resolution data, that could then improve upon the accuracy and currency of other freely available coastline data sets.</p><p>This method needed to be fully automated, repeatable and able to cope with a variety of different coastline types found across the globe.</p><h3><strong>How it works</strong></h3><p>First, we gather free, open-source optical satellite imagery with 10x10m pixels (available in <a href="https://developers.google.com/earth-engine/datasets/catalog/sentinel/">Earth Engine</a>). Sometimes pixels in these images can be obscured by shadow and cloud. So, by collecting all images taken of an area over the course of a year, we were able to select the ‘best pixel’ for every individual pixel location. By combining all the best pixels, we created a single image of the whole area that was free from any obscurities.</p><p>From this single image, we then identify areas of water by calculating what is called the <a href="https://en.wikipedia.org/wiki/Normalized_difference_water_index">‘Normalised Difference Water Index’ (NDWI)</a> : a remote sensing technique that uses the green and infrared bands to indicate the presence of water.</p><p>On further analysis of our results, we then discovered that we needed to account for localised variation. To overcome this issue we calculated the land/water threshold for small areas dynamically using a method called <a href="http://www.labbookpages.co.uk/software/imgProc/otsuThreshold.html">Otsu thresholding</a>, which finds the optimum value between two groups of pixels.</p><p>We then used the outputs from this pipeline to produce a vectorised image of the coastline using <a href="https://postgis.net/">PostGIS</a>.</p><h3><strong>The result</strong></h3><p>The first data generated by this pipeline covers the British Isles (except for Rockall, which was too small given the resolution of the imagery!).</p><p>Below you can see a data set of the British Isles, created using a total of 4,084 Sentinel-2 images:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*ZMM_Yx5d6P505rWbFNra2g.png" /><figcaption>UK Hydrographic Office © Crown Copyright 2019. Created using Google Earth Engine. Imagery Earthstar Geographics SIO, © 2020 HERE, Map data © 2020 Microsoft</figcaption></figure><p>This is the first time that coastline has been automatically generated at the UKHO and the process is still being evaluated, developed and improved. As such, we are not producing this data for navigational purposes yet.</p><p>To assess the success of our method, we compared our results to the widely-used <a href="https://shoreline.noaa.gov/data/datasheets/wvs.html">NGA World Vector Shoreline (WVS)</a> data set. The comparison showed that our methods captured better detail and accuracy in some instances, as you can see from the images below (where the WVS is shown in red and our results shown in blue):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wZysuT-dWN3SOvcqahZWiA.gif" /><figcaption>UK Hydrographic Office © Crown Copyright 2019. Created using Google Earth Engine. Imagery Earthstar Geographics SIO, © 2020 HERE, Map data © 2020 Microsoft</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oHd-kv6leNQb9pRFY9sorg.gif" /><figcaption>UK Hydrographic Office © Crown Copyright 2019. Created using Google Earth Engine. Imagery Earthstar Geographics SIO, © 2020 HERE, Map data © 2020 Microsoft</figcaption></figure><p>In addition to these results, we generated coastline in over 40 areas around the rest of the world to test the performance of the model in different geographic locations, to help us understand what areas need improvement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXe6JlfulajGVQQ60UC2Vg.gif" /><figcaption>UK Hydrographic Office © Crown Copyright 2019. Created using Google Earth Engine. Imagery Earthstar Geographics SIO, © 2020 HERE, Map data © 2020 Microsoft</figcaption></figure><h3><strong>Accessing the data set</strong></h3><p>A data set of the British Isles is now available to access via the ADMIRALTY Marine Data Portal — our platform for marine data sets held by the UKHO. This data is currently in the alpha stage and further improvements are being made.</p><p><a href="https://datahub.admiralty.co.uk/portal/apps/sites/#/marine-data-portal">Access the coastline data set on the ADMIRALTY Marine Data Portal.</a></p><p><em>This article originally appeared on </em><a href="https://ukhodigital.blog.gov.uk/2020/02/12/creating-coastlines-using-data-science/"><em>ukhodigital.blog.gov.uk</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=296fa5f2985b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/uk-hydrographic-office/mapping-the-worlds-coastlines-with-satellite-imagery-part-i-296fa5f2985b">Mapping the world’s coastlines with satellite imagery — Part I</a> was originally published in <a href="https://medium.com/uk-hydrographic-office">UK Hydrographic Office</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>