<?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 Fraser King on Medium]]></title>
        <description><![CDATA[Stories by Fraser King on Medium]]></description>
        <link>https://medium.com/@frasertheking?source=rss-3de75072e25d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9KaPKk_S0eXbf000YevLvA.png</url>
            <title>Stories by Fraser King on Medium</title>
            <link>https://medium.com/@frasertheking?source=rss-3de75072e25d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:44:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@frasertheking/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[Beyond the Blind Zone]]></title>
            <link>https://medium.com/data-science/beyond-the-blind-zone-706ba4b171c5?source=rss-3de75072e25d------2</link>
            <guid isPermaLink="false">https://medium.com/p/706ba4b171c5</guid>
            <category><![CDATA[thoughts-and-theory]]></category>
            <category><![CDATA[inpainting]]></category>
            <category><![CDATA[unet]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[explainable-ai]]></category>
            <dc:creator><![CDATA[Fraser King]]></dc:creator>
            <pubDate>Fri, 05 Apr 2024 17:27:22 GMT</pubDate>
            <atom:updated>2024-04-05T17:27:22.367Z</atom:updated>
            <content:encoded><![CDATA[<h4>Inpainting radar gaps with deep learning</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rADKbgXmGjWkY-LfuiUiFA.gif" /></figure><h3>Overview</h3><p>In this post, we review high-level details from our recent work on image inpainting of radar blind zones. We discuss the main science problems, inpainting techniques, model architecture decisions, fidelity metrics, uncertainties, and finish with an analysis of model explainability (XAI), in the hope that this information can help others when planning future, similar projects. This work was recently published in the American Meteorologic Society’s Artificial Intelligence for Earth Sciences (AIES) <a href="https://doi.org/10.1175/AIES-D-23-0063.1">https://doi.org/10.1175/AIES-D-23-0063.1</a>, which we recommend readers view for additional project details.</p><h3>Motivation</h3><p>Radar observations are powerful sources of information for tasks like precipitation forecasting. These systems are used by millions of people daily to help plan their lives, and their predictive accuracy has large economic impacts to agriculture, tourism, and the outdoor recreation industry. But how do these systems work? In a nutshell, these predictive models relate precipitation rates to power backscatter measurements from a radar signal interacting with falling hydrometeors in the atmosphere (Fig. 1). With a large enough reference dataset, we can take the information produced by the radar profile (along with some atmospheric state variables) and back-out an estimate of surface precipitation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jFwWo_YRxjHsuSX2-GTVMQ.png" /><figcaption><strong>Figure 1:</strong> a) Reflectivity profile showing the power backscattered by the cloud; b) Vertical profile of the snowfall rate estimates in the cloud; and c) surface snowfall rates extrapolated down from the lowest precipitating cloud layer shown in b). Image retrieved from King et al., 2020 (<a href="https://doi.org/10.1029/2019EA000776">https://doi.org/10.1029/2019EA000776</a>).</figcaption></figure><p>Unlike vertical-pointing surface radar instruments which are stationary, satellites are unrestricted in space and can provide a much richer, comprehensive view of global precipitation patterns due to their orbit. However, unlike surface radars, satellite instruments exhibit a unique type of measurement problem since they point down towards the Earth: a radar blind zone. As implied by its name, the blind zone is a portion of the radar profile that the satellite cannot directly observe. As the downward pointed radar signal reaches the Earth’s surface, the backscatter from the ground produces an attenuated signal that becomes saturated with noise (and therefore unobserved). A comparison between surface and spaceborne radars (and the corresponding blind zone) is illustrated in Fig. 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FcWQedWtnXL5UXV2bL5Tbw.png" /><figcaption><strong>Figure 2:</strong> Multi-panel of coincident vertical reflectivity profiles from a surface radar, CloudSat and the Global Precipitation Measurement mission, along with their respective radar blind zones. Image retrieved from Kidd et al., 2021 (<a href="https://doi.org/10.3390/rs13091708">https://doi.org/10.3390/rs13091708</a>).</figcaption></figure><p>While the size of the blind zone region can vary, it is a common issue on active spaceborne systems (e.g. GPM, CloudSat) that will persist as a source of uncertainty in future Earth observing missions (e.g. EarthCARE and AOS). Additionally, although this region is just a small subset of the full profile (only about 4% of CloudSat’s vertical extent, for instance), this 0–2 km of the atmosphere can contain large quantities of precipitating cloud (Lamer et al., 2020). Therefore, by masking this region, we are potentially missing a large quantity of snow (or overestimating snow in the case of virga), further increasing the uncertainty of an already uncertain estimate of surface snow accumulation.</p><blockquote><em>… the blind zone leads to reflectivity being underestimated by up to 1 dB, the number of events being altered by +/- 5% and the precipitation amount being underestimated by 9 to 11 percentage points (Maahn et al., 2014).</em></blockquote><p><strong>What can we do about this?</strong></p><h3>Our Solution</h3><p>At its core, the ideas behind image inpainting have been around for decades for use in things like image restoration (e.g. removing a scratch on a family photo), or object removal (removing a tourist in a picture from your last vacation) (Guillemot and Le Meur, 2013). Originally, this type of repair was a costly endeavour that was done by hand by a trained artist (Fig. 2), but as has become increasingly clear in recent years, computers are quite skilled at this task too (with much shorter training times compared to a human)!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jR4WpXDCQ_tkueJ7UJvzeg.png" /><figcaption><strong>Figure 3:</strong> Painting restoration by hand by a trained professional. Image courtesy of Ana Alba.</figcaption></figure><p>While the first iterations of these techniques like structure-based linear interpolation, texture-synthesis-based Efros interpolation, and diffusion-based Laplace or Navier-Stokes interpolation can work well in certain contexts, they often fell short when dealing with large gaps. The differences between these techniques are shown in Fig. 4 where an elephant mask is inpainted in the center of the image. These techniques rely heavily on information/patterns from the edges of the targeted inpainting region and are often unable to effectively make use information from the scene’s global context when making intelligent predictions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vcjZlc29Pb4lirXOLPmbOQ.png" /><figcaption><strong>Figure 4:</strong> Object removal application a) mask and inpainting results with methods from different categories; b) anisotropic diffusion, c) exemplar-base; d) patch sparse representation, e) hybrid with one global energy minimization; and f) patch offsets. Image retrieved from Guillemot and Le Meur, 2013 (<a href="https://doi.org/10.1109/MSP.2013.2273004">https://doi.org/10.1109/MSP.2013.2273004</a>).</figcaption></figure><p>However, the field of computer vision has flourished in recent decades, primarily driven by advances in computing power and the development of newer, more efficient machine learning techniques. Generative approaches using Generative Adversarial Networks (GANs) for instance have been very popular recently with OpenAI’s <a href="https://openai.com/dall-e-2">DALL-E</a>, or Stability.ai’s <a href="https://stability.ai/blog/stable-diffusion-public-release">Stable Diffusion</a>, producing incredibly realistic images based on a simple text prompt. There has also been some work previously attempting to use similar methods for inpainting, but there exists a trade-off between realism and fidelity/stability for inpainting taskings (Lugmayr et al., 2017; Geiss and Hardin, 2021).</p><p>For instance, while you might generate a region of an image that looks great to the human eye, the actual pixel values are not necessarily correct if compared to a reference image and may vary quite a bit based on the provided random noise/seed (Fig. 5). This is not unexpected, though, as these techniques are not necessarily constructed with such constraints in mind and exist for other purposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TQqcWF-jXFOsaqUl6X_CJQ.png" /><figcaption><strong>Figure 5:</strong> A set of examples from the <em>Denoising Diffusion Probabilistic Models (DDPM) project for image inpainting introduced in </em>Lugmayr et al., 2017 (<a href="https://doi.org/10.1109/CVPR52688.2022.01117">https://doi.org/10.1109/CVPR52688.2022.01117</a>).</figcaption></figure><p>Instead, we focus on another machine learning architecture in this work: the U-Net. U-Nets are a class of Convolutional Neural Networks (CNNs), that ingest information in the form of an image (typically) and produce an output that is of the same dimensions. Often used for image segmentation, the encoder-decoder architecture of the U-Net allow the model to learn both local and global features of an image (context that is often quite valuable for correctly interpreting an image’s content during inpainting). We will use this architecture to teach the model to learn about latent features in aloft cloud to predict near surface reflectivity data in the aforementioned radar blind zone.</p><h3>Data</h3><p>The data used in this project comes from primary two sources:</p><ol><li><a href="https://www.arm.gov/capabilities/science-data-products/vaps/kazrarsclcloudsat"><strong>ARM KaZR CloudSat-aligned reflectivity</strong></a></li><li><a href="https://www.ecmwf.int/en/forecasts/dataset/ecmwf-reanalysis-v5"><strong>ERA-5</strong></a></li></ol><p>Both datasets are publicly available (governed by the <a href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International (CC BY 4.0)</a>) and are collocated at two Arctic locations in northern Alaska, USA at North Slope and Oliktok Point (Fig. 6). Since we are focused on snowfall, we limit our observations to cold periods below 2 degrees C. Further, data is split in contiguous training/validation/testing chunks to avoid overfitting from autocorrelation as shown in Fig. 6.c. We are using radar reflectivity data from the ARM KaZR, along with temperature, specific humidity, u-component wind, and v-component wind from ERA-5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7xQAmmuBLDlBrm17YBvGRQ.png" /><figcaption><strong>Figure 6:</strong> a) Study site locations; b) surface MET temperature timeseries at NSA and OLI; and c) data splitting methods used for model training. Image by author.</figcaption></figure><h3>Our Model</h3><p>What type of U-Net should be used for this task? We experimented with a variety of different U-Nets in this project, including the UNet++ model from Zhou et al., 2018 and the 3Net+ from Huang et al., 2020. But let’s talk about the model architecture for a moment. For instance, why use these methods over a just a traditional U-Net? First let’s review how U-Nets work.</p><p>U-Nets are primarily thought of in three parts, an encoder path, a bottleneck layer, and a decoder path. The encoder is responsible for taking your initially high-resolution image, and through a series of convolutions and pooling steps, trades spatial information for rich feature information (learning about the latent context of your image). Depending on how deep your network is, these latent features are encoded most densely in the lowest dimensionality bottleneck layer at the base of the U. At this point, the image array may be only a fraction of the size of the original, and while you’ve lost most of the spatial information, the model has identified a set of embeddings that represent what it sees as key elements. Then, in the decoder path, the reverse occurs. The low-resolution, feature-rich arrays in the bottleneck layer are downsampled until the feature information has been transformed back into spatial information (resulting in a final image that has the same dimensions as the original).</p><p>One of the key differences between a U-Net, U-Net++ and 3Net+, is how each variation handles skip connections (Fig. 7). Skip connections allow these models to “skip” some data directly across the encoder path to be used in the decoder, which helps in conveying low-level feature information during decoding and produces a more stable model that converges in meaningful ways. In a vanilla U-Net for example, these connections simply concatenate feature maps from the contracting encoder path to the corresponding level in the decoding expansive path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jMNhVx2b7OL_elnTH_RG-Q.png" /><figcaption><strong>Figure 7:</strong> Comparisons between a) U-Net; b) U-Net++; and c) 3Net+ model architectures. Image retrieved from Huang et al., 2020 (<a href="https://doi.org/10.48550/arXiv.2004.08790">https://doi.org/10.48550/arXiv.2004.08790</a>).</figcaption></figure><p>The UNet++ introduces a series of nested and dense skip pathways that attempt to address the issue of the unknown depth of the optimal architecture in a traditional U-Net. Instead of just having direct connections from the encoder to the decoder, the UNet++ has multiple skip pathways. For a given level in the encoder, there are skip connections to all subsequent levels in the decoder, creating a dense set of connections. These nested skip connections are designed to capture and fuse features at various semantic levels more effectively than the vanilla U-Net, however this comes at the cost of a larger model (more parameters) and increased training times.</p><p>The 3Net+ builds on ideas of both previous techniques and is the architecture used in our final model (Fig. 8). This method breaks the skip connections into a series of across-skip connections (similar to the vanilla U-Net), inter-skip connections, and intra-skip connections. These inter- and intra- skip connections make full use of multi-scale features in the scene by passing information in a manner which incorporates low-level details with high-level semantics from feature maps in full scales, but with fewer parameters to the U-Net++ model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P1oN4YQypMH6lNC1rH_HVg.png" /><figcaption><strong>Figure 8:</strong> a) 128x128 chunks of input KaZR and ERA-5 variables; and b) our model’s 3Net+ architecture with deep supervision layers. Image by author.</figcaption></figure><p>Further, our model makes use of deep supervision to learn hierarchical representations from the full-scale aggregated feature maps at each level of the decoder. This helps the model learn to correctly position clouds within the blind zone by examining the wider context of the scene. In the remaining sections we will compare the skill of this 3Net+ model trained on just reflectivity (herein denoted as 3+_1), another version trained on reflectivity and ERA5 data (3+_5) and two linear inpainting techniques using repeating extrapolation (REP) and marching average (MAR) methods. For additional details on how these are implemented, please refer to our AIES paper.</p><h3>Fidelity</h3><p>To comprehensively evaluate model performance in blind zone reconstructive accuracy, we will first examine a handful of common cases, followed by a more general statistical analysis of the full test dataset. Note that all results shown from here on out are strictly taken from the unseen test set of observations.</p><h4>Case Studies</h4><p>Examples of inpainted blind zone reflectivity values (taken from both NSA and OLI) for REP, MAR, 3+ 1 and 3+ 5 models, along with the corresponding target KaZR VAP product (i.e. the ground truth) in the far left column are shown below in Figs. 9/10.</p><p>This first set of examples highlights cases of near surface reflectivity gradients and cloud gaps that are common at both locations. The black dashed line indicates the 1.2 km blind zone threshold (values below this are masked and reconstructed by each model), and the shaded regions indicate areas of high uncertainty in the inpainted U-Net predictions (more on this later in the Monte Carlo Dropout section).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pcS978dmEMBweoKmTpLKUA.png" /><figcaption><strong>Figure 9:</strong> Examples a)-e) of inpainted blind zone reflectivity values (taken from both NSA and OLI) for REP, MAR, 3+_1 and 3+_5 models, along with the corresponding target KaZR VAP product (i.e. the ground truth) in the far left column. This set of examples highlights cases of near surface reflectivity gradients and cloud gaps. Image by author.</figcaption></figure><p>We find that the linear models (REP and MAR) perform well for deep, homogeneous systems, but fall short in more complex cases. Further, due to their reliance on blind zone threshold reflectivities, reflectivity gradients (vertical and horizontal) are missed by REP and MAR (and usually captured using the U-Nets). Finally, shallow, Arctic mixed-phase clouds can also be resolved using U-Nets, along with cloud gaps and cases of virga (Fig. 10), which is exciting as this has substantial implications to surface snowfall quantities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uhv5-f1x7RYDgZtyT-mf-Q.png" /><figcaption><strong>Figure 10:</strong> The same as Fig. 9, now focusing on shallow snowfall and virga cases for each model’s inpainted predictions. Image by author.</figcaption></figure><p>The most challenging cases to accurately model are those with sparse reflectivity profiles and distant cloud. For instance, consider Fig. 11 showing two similar cases at NSA occurring in different years. To the human eye, both locations have very similar cloud structures, however one has a shallow near surface cloud in the blind zone while the other does not. The linear inpainting techniques are clearly well outside of their comfort zone here and will always produce the same “no cloud” output as we see in a). However, the U-Net models are still able to resolve cloud presence in cases such as this, with the 3+_5 model using the additional context from ERA-5 to better understand that the atmospheric conditions in this case likely result in blind zone cloud.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xw2rqjZpkD-73vfzOztLOg.png" /><figcaption><strong>Figure 11:</strong> a) Example of a case where a cloud aloft (with mean reflectivity near -20 dBZ) has no near surface activity in the blind zone; and b) a similar cloud structure to a), except in this case there does exist a near surface band of reflectivity in a shallow cloud that is correctly identified using the 3+_5 model. Image by author.</figcaption></figure><h4>Robustness</h4><p>As we can see in Fig. 12 a), the U-Net PSD curves are closer to observations compared to the linear methods. Further, the nonlinear reconstructions produce a more realistic lowest cloud echo height (shown in the probability density plots of b), suggesting that we are better capturing cloud positions. Finally, the entire blind zone structure is summarized in c)-g), where the linear methods are able to capture general macro-scale trends in reflectivity but fall short of capturing the fine-scale variability. We do note that the U-Net models have a slight “cold” bias towards -60 dBZ due to their tendency to produce “safer” estimates closer to “no cloud” over much rarer, high intensity snowfall events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n47SrZDBSU3dibYxOjprvw.png" /><figcaption><strong>Figure 12:</strong> Cloud structure metrics including a) vertical power spectral density curves; b) lowest reflectivity echo layer probability density plot; and c) 2d reflectivity histograms. Image by author.</figcaption></figure><p>Further, improving our predictions of surface snowfall and virga cases would have substantial hydrologic implications and reduce our uncertainty in snow accumulation quantities. So, we performed checks to see how well three cases were reconstructed with our model using probability of detection (POD) and false alarm rate (FAR):</p><ol><li>Blind zone cloud presence (i.e. was any cloud detected)</li><li>Shallow snowfall (i.e. was there snowfall at the surface but not at the blind zone threshold)</li><li>Virga (i.e. was there snowfall detected at the blind zone threshold but not at the surface)</li></ol><p>The critical success index (CSI) for each of these metrics is shown in the performance diagram below (Fig. 13), with the 3+_5 model performing the best overall. Shallow snowfall cases were typically the hardest to reconstruct, as we saw these cases can be quite tricky to get right (Fig. 11).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rt4KYdqFs4QJUdI464DNXQ.png" /><figcaption><strong>Figure 13:</strong> Cloud, shallow snowfall and virga detection performance diagram for each model. Image by author.</figcaption></figure><h3>Explainability</h3><p>To add further trust in the model’s decision-making process, we also performed a series of <a href="https://towardsdatascience.com/what-is-explainable-ai-xai-afc56938d513#:~:text=Explainable%20AI%20refers%20to%20methods,be%20understood%20by%20human%20experts.">eXplainable Artificial Intelligence (XAI)</a> tests (i.e., thinking towards a mechanistic interpretation of model behaviour). These tests were aimed at connecting model behaviour to logical physical processes to both inspire confidence in the model and provide additional insights for potentially enhancing future retrievals. If we can learn about previously unknown connections in the data, that can be very valuable! Separately, each individual XAI method gives a slightly different “local” explination of the decision-making process, and it is therefore useful to incorporate multiple tests to derive a more robust understanding.</p><h4>Feature Maps</h4><p>The first, most basic, test we considered were feature/activation maps. By examining the values of the reLU activator in different levels of the encoder path of Fig. 8.b, we get a rough idea of where the model is looking in an image for a given input. As shown in Fig.14 below, the e1 encoder layer of the 3+_5 model typically looked along cloud edges, at reflectivity gradients and directly along the blind zone threshold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C0802EhLhm86BOcwhPHaEQ.png" /><figcaption><strong>Figure 14:</strong> a) Example reflectivity input to the 3+_5 model; and b) the set of 32 feature maps produced by the e1 encoder layer of the model. Image by author.</figcaption></figure><h4>Drop Channel Importance</h4><p>One of the biggest questions in this project was whether ERA-5 was providing useful context to the model. If we can use a more simplistic U-Net that only relies on reflectivity for instance (i.e. the 3+_1 model), then we should do so, as this would be more computationally efficient. However, if the additional atmospheric state variables from ERA-5 provide the model with useful context for inpainting complex systems, then the use of this more complex model may be warranted.</p><p>Since we only have a handful of inputs in this case (1 mandatory (radar) and 4 supplementary (temperature, humidity, u-wind, and v-wind), we can do an exhaustive search of the input space to evaluate their marginal contributions to accuracy. More formally, this drop-channel approach uses the below formula (Eq. 1/ Eq. 2) to calculate marginal contributions of importance from the provided inputs. Note that this technique does not consider potential nonlinear interactions between inputs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kaW9Iri6Doq9ySw7_J06aw.png" /><figcaption><strong>Eq. 1 / Eq. 2:</strong> Used in calculating marginal importance from N inputs. Image by author.</figcaption></figure><p>If we perform a series of this test runs (25 epochs) and examine changes in the validation loss, we can gain some rough insight into which inputs are most useful. The results of these tests are shown below in Fig. 15, where we note a trend of decreasing validation loss as we add more ERA-5 inputs (suggesting that none of the inputs are wholly unimportant). Further, the marginal contributions to validation loss suggest that the wind data is the most influential overall. We believe that this importance may stem from that fact that in the upper troposphere, wind patterns can hint at mesoscale atmospheric dynamics, such as the presence of high or low-pressure systems, fronts, and jet streams (which are of course linked to cloud/hydrometeor formation).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jnRUXZoXmRVDCiFEfvUAfg.png" /><figcaption><strong>Figure 15:</strong> Input channel combination contributions to inpainting performance in 3Net+ models. Image by author.</figcaption></figure><h4>Saliency Maps</h4><p>Finally, we also examined saliency maps for a handful of cases (Fig. 16), to further compare the differences in importance between the 3+_5 and 3+_1 models. These pixel attribution vanilla gradient saliency maps are inspired by the work of Simonyan et al., 2014, and provide additional insight into areas the model identifies as crucial contributors of information for inpainting accuracy using a given input. These saliency maps are generated by running an image through the network and subsequently extracting the gradients of the output based on the input across all channels. While simplistic, this method is particularly useful for visualizing which parts of the observed image are most valuable in inpainting the blind zone reflectivity values, allowing for direct plotting of the activation gradients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IuKrsN62j32O5-287bqFZA.png" /><figcaption><strong>Figure 16:</strong> Vanilla gradient saliency maps for both the 3+_1 and 3+_5 models, along with the corresponding ERA5 atmospheric state variables for a handful of cases at NSA. Image by author.</figcaption></figure><p>For multilayer clouds that intersect with the blind zone cut-off (e.g. Fig. 16.a), both models focus on the top of the cloud and the 1.2 km boundary threshold, as these systems often continue to extend down to the surface with similar reflectivity intensities. Both models also typically focus on and around cloud gaps in deeper systems (e.g. Fig. 16.b), however, a distinct halo of importance towards the tropopause is noticeable in the 3+_5 model. This recurring feature is likely incorporating upper troposphere wind and humidity data into predictions of near surface reflectivity. Interestingly, the 3+_1 model does not solely focus on the areas of high reflectivity in the scene but also on the regions around the cloud.</p><h3>Applications</h3><p>The motivating goal of this work is to eventually apply a surface trained U-Net to spaceborne observations. While additional work needs to be completed on resolution-matching between these two systems, we performed early tests against coincident CloudSat-CPR observations near NSA. The idea here being that both systems (while not perfectly overlapped), will be observing similar portions of the same storm system. We consider a handful of examples and include one below for a shallow cumuliform snowfall case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*utGVOYkyfjZV7VCgqRbKug.png" /><figcaption><strong>Figure 17:</strong> a) Map depicting a CloudSat overpass granule path (red), 128-step site-coincident CloudSat footprint near NSA, and white point showing the closest observed profile to the site (black circle represents a 50 km radius around the site); b) CloudSat reflectivity profile of a shallow cumuliform system, with the region between the two dashed lines representing the blue (coincident) portion of the overpass in a), and the white shaded region showing the satellite blind zone; c) Vertical NSA KaZR reflectivity profile, with the corresponding overpass period from b) shown in the region between the two dashed lines; d) A closeup of the KaZR CloudSat coincident profile from c); e) The CloudSat-NSA coincident profile from b); and f-h) The REP, MAR and 3+_1 inpainted blind zone scenes, respectively, when provided with e) as input. Image by author.</figcaption></figure><p>In this example, we noted that both the spaceborne and surface radars observed a shallow cloud about 3 km tall (however CloudSat misses the increased reflectivity gradient below the blind zone due to surface clutter). When this region is reconstructed using both the traditional techniques and our U-Net, we find the U-Net is the only method that can accuratly represent the band of increased reflectivity around 1 km. More formally, if we look at the structure between the nearest CloudSat observation to the site (white dashed line) to each of the closest reconstructed regions, Pearson correlations are substantially improved using the U-Net (r_MAR=0.13 to r_3+_1=0.74).</p><p>While these examples don’t comprise a comprehensive anaylsis allowing us to say something about general performance, they do indicate that we see skill consistent with what we have previous noted when looking at the simulated surface blind zone. Further application work to spaceborne instruments is ongoing.</p><h3>Final Notes</h3><p>Before we finish up this already long post, I wanted to highlight a few of the other features we built into the model and provide some training code examples for those interested in developing their own inpainting model.</p><h4>Monte Carlo Dropout</h4><p>Unlike traditional Bayesian methods, we do not directly produce a physically-based uncertainty estimate using a U-Net. To get a rough idea of model confidence and stability, we decided to introduce a dropout at inference layer to the model based on the work of Gal and Ghahramani, 2016 which allows us to generate a distribution of inpainted predictions for each test case. These distributions allow us to produce confidence intervals for each inpainted pixel, and further refine our estimates to regions that model is more certain of when inpainting. An example of this is shown below in Fig. 17.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*uVdp2fkRu4LSY7WFc6T5WA.gif" /><figcaption><strong>Figure 18:</strong> Monte Carlo dropout example outputs (n=50 iterations). Image by author.</figcaption></figure><p>We typically use N=50 iterations per case, and as we can see above, the areas with the highest uncertainty are typically cloud edges and cloud gaps, as the model often hallucinates when positioning these features.</p><h4>Training Statistics</h4><p>Model training for this project was completed on two sets of hardware, including a Linux-based GPU computing cluster on Microsoft Azure, and a high-performance desktop running Windows 11 (additional system details in Table 1). An extensive Bayesian hyperparameter sweep was also performed over the course of 2 days. Further, batch normalization is applied along with early stopping (n=20), dropout and L2 regularization (ridge regression) to help mitigate overfitting during the training process. Learning rate decay is also applied at two epochs (450 and 475), allowing the model to more easily settle into a local loss minima near the end of the training phase. All training runs and hyperparameter sweeps are saved online using the<a href="https://wandb.ai/"> Weights &amp; Biases cloud storage option</a>, to monitor model learning rates and stability over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dPLBjS_A5-5uIZXd3gC7IQ.png" /><figcaption><strong>Table 1:</strong> Summary details of hardware used for model training. Image by author.</figcaption></figure><h4>Example Code</h4><p>A link to the GitHub is here: <a href="https://github.com/frasertheking/blindzone_inpainting">https://github.com/frasertheking/blindzone_inpainting</a></p><p>However, I wanted to provide an overview of the actual 3Net+ implementation (with variable depth) in Tensorflow below for those interested in playing around with it.</p><pre>def conv_block(x, kernels, kernel_size=(3, 3), strides=(1, 1), padding=&#39;same&#39;, is_bn=True, is_relu=True, n=2, l2_reg=1e-4):<br>    for _ in range(1, n+1):<br>        x = k.layers.Conv2D(filters=kernels, kernel_size=kernel_size,<br>                            padding=padding, strides=strides,<br>                            kernel_regularizer=tf.keras.regularizers.l2(l2_reg),<br>                            kernel_initializer=k.initializers.he_normal(seed=42))(x)<br>        if is_bn:<br>            x = k.layers.BatchNormalization()(x)<br>        if is_relu:<br>            x = k.activations.relu(x)<br>    return x<br><br>def unet3plus(input_shape, output_channels, config, depth=4, training=False, clm=False):<br><br>    &quot;&quot;&quot; Prep &quot;&quot;&quot;<br>    interp = config[&#39;interpolation&#39;]<br>    input_layer = k.layers.Input(shape=input_shape, name=&quot;input_layer&quot;)<br>    xpre = preprocess(input_layer, output_channels)<br><br>    &quot;&quot;&quot; Encoder &quot;&quot;&quot;<br>    encoders = []<br>    for i in range(depth+1):<br>        if i == 0:<br>            e = conv_block(xpre, config[&#39;filters&#39;]*(2**i), kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), l2_reg=config[&#39;l2_reg&#39;])<br>        else:<br>            e = k.layers.MaxPool2D(pool_size=(2, 2))(encoders[i-1])<br>            e = k.layers.Dropout(config[&#39;dropout&#39;])(e, training=True)<br>            e = conv_block(e, config[&#39;filters&#39;]*(2**i), kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), l2_reg=config[&#39;l2_reg&#39;])<br>        encoders.append(e)<br><br>    &quot;&quot;&quot; Middle &quot;&quot;&quot;<br>    cat_channels = config[&#39;filters&#39;]<br>    cat_blocks = depth+1<br>    upsample_channels = cat_blocks * cat_channels<br><br>    &quot;&quot;&quot; Decoder &quot;&quot;&quot;<br>    decoders = []<br>    for d in reversed(range(depth+1)):<br>        if d == 0 :<br>            continue<br>        loc_dec = []<br>        decoder_pos = len(decoders)<br>        for e in range(len(encoders)):<br>            if d &gt; e+1:<br>                e_d = k.layers.MaxPool2D(pool_size=(2**(d-e-1), 2**(d-e-1)))(encoders[e])<br>                e_d = k.layers.Dropout(config[&#39;dropout&#39;])(e_d, training=True)<br>                e_d = conv_block(e_d, cat_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, l2_reg=config[&#39;l2_reg&#39;])<br>            elif d == e+1:<br>                e_d = conv_block(encoders[e], cat_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, l2_reg=config[&#39;l2_reg&#39;])<br>            elif e+1 == len(encoders):<br>                e_d = k.layers.UpSampling2D(size=(2**(e+1-d), 2**(e+1-d)), interpolation=interp)(encoders[e])<br>                e_d = k.layers.Dropout(config[&#39;dropout&#39;])(e_d, training=True)<br>                e_d = conv_block(e_d, cat_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, l2_reg=config[&#39;l2_reg&#39;])<br>            else:<br>                e_d = k.layers.UpSampling2D(size=(2**(e+1-d), 2**(e+1-d)), interpolation=interp)(decoders[decoder_pos-1])<br>                e_d = k.layers.Dropout(config[&#39;dropout&#39;])(e_d, training=True)<br>                e_d = conv_block(e_d, cat_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, l2_reg=config[&#39;l2_reg&#39;])<br>                decoder_pos -= 1<br>            loc_dec.append(e_d)<br>        de = k.layers.concatenate(loc_dec)<br>        de = conv_block(de, upsample_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, l2_reg=config[&#39;l2_reg&#39;])<br>        decoders.append(de)<br><br>    &quot;&quot;&quot; Final &quot;&quot;&quot;<br>    d1 = decoders[len(decoders)-1]<br>    d1 = conv_block(d1, output_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, is_bn=False, is_relu=False, l2_reg=config[&#39;l2_reg&#39;])<br>    outputs = [d1]<br><br>    &quot;&quot;&quot; Deep Supervision &quot;&quot;&quot;<br>    if training:<br>        for i in reversed(range(len(decoders))):<br>            if i == 0:<br>                e = conv_block(encoders[len(encoders)-1], output_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, is_bn=False, is_relu=False, l2_reg=config[&#39;l2_reg&#39;])<br>                e = k.layers.UpSampling2D(size=(2**(len(decoders)-i), 2**(len(decoders)-i)), interpolation=interp)(e)<br>                outputs.append(e)<br>            else:<br>                d = conv_block(decoders[i - 1], output_channels, kernel_size=(config[&#39;kernel_size&#39;], config[&#39;kernel_size&#39;]), n=1, is_bn=False, is_relu=False, l2_reg=config[&#39;l2_reg&#39;])<br>                d = k.layers.UpSampling2D(size=(2**(len(decoders)-i), 2**(len(decoders)-i)), interpolation=interp)(d)<br>                outputs.append(d)<br><br>    if training:<br>        for i in range(len(outputs)):<br>            if i == 0:<br>                continue<br>            d_e = outputs[i]<br>                d_e = k.layers.concatenate([out1, out2, out3])<br>            outputs[i] = merge_output(input_layer, k.activations.linear(d_e), output_channels)<br><br>    return tf.keras.Model(inputs=input_layer, outputs=outputs, name=&#39;UNet3Plus&#39;)</pre><h3>Future</h3><p>I know this was a long post, and we covered a lot of stuff, but I want to give a quick summary of everything we’ve covered for those who have made this far (or those who skipped to the end).</p><p>The satellite radar blind zone is an ongoing problem on satellite-based Earth observing precipitation missions, with critical implications to global water-energy budget calculations. In order to overcome common issues with traditional linear inpainting methods for filling in this region, we opted to use a nonlinear, deeply supervised U-Net for radar blind zone inpainting. The U-Net outperforms linear techniques across nearly all metrics and can even reconstruct complex cloud structures like multilayer clouds, cloud gaps and shallow cloud. Further, using a variety of XAI techniques, we saw that information directly at the blind zone threshold and along the tropopause (especially wind information) was found to be very useful in the model’s decision-making process. While we don’t suggest that these models fully replace current physically-based solutions, we believe they offer a unique new perspective that can be used to supplement other retrievals in future missions.</p><p>We are currently working on a follow-up project to this with direct applications to CloudSat-CPR observations.</p><h3>Referernces</h3><p>Gal, Y., &amp; Ghahramani, Z. (2016). Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning (arXiv:1506.02142). arXiv. <a href="https://doi.org/10.48550/arXiv.1506.02142">https://doi.org/10.48550/arXiv.1506.02142</a></p><p>Geiss, A., &amp; Hardin, J. C. (2021). Inpainting radar missing data regions with deep learning. Atmospheric Measurement Techniques, 14(12), 7729–7747. <a href="https://doi.org/10.5194/amt-14-7729-2021">https://doi.org/10.5194/amt-14-7729-2021</a></p><p>Guillemot, C., &amp; Le Meur, O. (2014). Image Inpainting: Overview and Recent Advances. <em>IEEE Signal Processing Magazine</em>, <em>31</em>(1), 127–144. <a href="https://doi.org/10.1109/MSP.2013.2273004">https://doi.org/10.1109/MSP.2013.2273004</a></p><p>Huang, H., Lin, L., Tong, R., Hu, H., Zhang, Q., Iwamoto, Y., Han, X., Chen, Y.-W., &amp; Wu, J. (2020). UNet 3+: A Full-Scale Connected UNet for Medical Image Segmentation (arXiv:2004.08790). arXiv. <a href="https://doi.org/10.48550/arXiv.2004.08790">https://doi.org/10.48550/arXiv.2004.08790</a></p><p>Kidd, C., Graham, E., Smyth, T., &amp; Gill, M. (2021). Assessing the Impact of Light/Shallow Precipitation Retrievals from Satellite-Based Observations Using Surface Radar and Micro Rain Radar Observations. Remote Sensing, 13(9), Article 9. <a href="https://doi.org/10.3390/rs13091708">https://doi.org/10.3390/rs13091708</a></p><p>King, F., &amp; Fletcher, C. G. (2020). Using CloudSat-CPR Retrievals to Estimate Snow Accumulation in the Canadian Arctic. Earth and Space Science, 7(2), e2019EA000776. <a href="https://doi.org/10.1029/2019EA000776">https://doi.org/10.1029/2019EA000776</a></p><p>Lamer, K., Kollias, P., Battaglia, A., &amp; Preval, S. (2020). Mind the gap — Part 1: Accurately locating warm marine boundary layer clouds and precipitation using spaceborne radars. Atmospheric Measurement Techniques, 13(5), 2363–2379. <a href="https://doi.org/10.5194/amt-13-2363-2020">https://doi.org/10.5194/amt-13-2363-2020</a></p><p>Lugmayr, A., Danelljan, M., Romero, A., Yu, F., Timofte, R., &amp; Van Gool, L. (2022). RePaint: Inpainting using Denoising Diffusion Probabilistic Models. 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 11451–11461. <a href="https://doi.org/10.1109/CVPR52688.2022.01117">https://doi.org/10.1109/CVPR52688.2022.01117</a></p><p>Maahn, M., Burgard, C., Crewell, S., Gorodetskaya, I. V., Kneifel, S., Lhermitte, S., Van Tricht, K., &amp; van Lipzig, N. P. M. (2014). How does the spaceborne radar blind zone affect derived surface snowfall statistics in polar regions? Journal of Geophysical Research: Atmospheres, 119(24), 13,604–13,620. <a href="https://doi.org/10.1002/2014JD022079">https://doi.org/10.1002/2014JD022079</a></p><p>Simonyan, K., Vedaldi, A., &amp; Zisserman, A. (2014). Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps (arXiv:1312.6034). arXiv. <a href="https://doi.org/10.48550/arXiv.1312.6034">https://doi.org/10.48550/arXiv.1312.6034</a></p><p>Zhou, Z., Siddiquee, M. M. R., Tajbakhsh, N., &amp; Liang, J. (2018). UNet++: A Nested U-Net Architecture for Medical Image Segmentation (arXiv:1807.10165). arXiv. <a href="https://doi.org/10.48550/arXiv.1807.10165">https://doi.org/10.48550/arXiv.1807.10165</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=706ba4b171c5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/beyond-the-blind-zone-706ba4b171c5">Beyond the Blind Zone</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do Neural Networks Dream of Falling Snow?]]></title>
            <link>https://medium.com/data-science/do-neural-networks-dream-of-falling-snow-89b5036ae324?source=rss-3de75072e25d------2</link>
            <guid isPermaLink="false">https://medium.com/p/89b5036ae324</guid>
            <category><![CDATA[editors-pick]]></category>
            <category><![CDATA[precipitation]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[snow]]></category>
            <dc:creator><![CDATA[Fraser King]]></dc:creator>
            <pubDate>Wed, 31 Aug 2022 14:03:13 GMT</pubDate>
            <atom:updated>2022-08-31T16:18:48.882Z</atom:updated>
            <content:encoded><![CDATA[<h4>Developing a deep learning radar-based precipitation retrieval</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSkPLR5xKOy55fhZylfACg.png" /><figcaption>DeepPrecip network compute graph rendering — Image by Graphcore and Author</figcaption></figure><p>The application of machine learning (ML) in the Geosciences is not a new idea. Early examples of k-means clustering, Markov chains and decision trees have been actively used in several geographical contexts since the mid-1960’s (<em>Preston et al., 1964</em>; <em>Krumbein et al., 1969</em>; <em>Newendorp, 1976</em>).</p><p>However, advancements in cloud computing resources from companies like <a href="https://www.graphcore.ai/">Graphcore</a>, <a href="https://aws.amazon.com/?nc2=h_lg">Amazon</a> and <a href="https://cloud.google.com/">Google</a>, combined with the ease-of-access to powerful ML libraries (e.g. <a href="https://www.tensorflow.org/">Tensorflow</a>, <a href="https://keras.io/">Keras</a>, <a href="https://pytorch.org/">PyTorch</a>) and flourishing developer communities, has allowed this emerging field to explode in popularity in recent years (<em>Dramsch, 2020</em>).</p><p>Now, ML models are not only regularly used in the Geosciences for operational forecasting (Ashouri et al., 2021), but for statistical inference as well; without the traditional uncertainties associated with physical model simulations of natural processes (<em>King et al., 2022</em>).</p><h4>The Problem</h4><p>Snowfall is an integral component of the global water and energy cycle with significant impacts to regional freshwater availability (<em>Musselman et al., 2021</em>;<em> Gray and Landine, 2011</em>). In fact, over 2 billion people (a sixth of the global population) rely on snowmelt-derived fresh water for human consumption and agricultural purposes each year (<em>Sturm et al., 2017</em>). As global mean temperatures continue to rise, snowfall frequency and intensity is also expected to change, leading to new water resource management challenges worldwide (<em>IPCC, 2019</em>).</p><p>However, traditional snowfall models have large uncertainties in their estimates and therefore new algorithms should be investigated to advance our understanding of shifting global snowfall patterns.</p><figure><img alt="mountain with snow" src="https://cdn-images-1.medium.com/max/1024/1*3Jp1WYZCDVvD4L4iUWBr3A.jpeg" /><figcaption>Complex snowfall visible over the Torres del Paine, Chile— Image by Author</figcaption></figure><p>So, let’s explore how<strong> ML is being used to advance the field of snowfall prediction, and where these techniques may lead in the future.</strong></p><h4>Our Solution</h4><p>Illustrated at the top of this post is <a href="https://github.com/frasertheking/DeepPrecip">DeepPrecip</a>. Or more accurately, a render of DeepPrecip’s compute graph that forms the basis of the model’s decision making process.</p><p>DeepPrecip is a deep convolutional neural network (CNN) developed at the <a href="https://uwaterloo.ca/">University of Waterloo</a> comprised of <strong>4 million</strong> trainable model parameters! Our goal with this model is to evaluate how well we can use ground radar data inputs to predict surface precipitation quantities under varying regional climates (<em>King et al., 2022–2</em>). This type of model is known as a precipitation “<em>retrieval</em>” as the inputs to this model are atmospheric radar observations (i.e. power backscattered from falling hydrometeors) and it outputs predictions about surface rain and snow.</p><p><strong>But how can atmospheric radar backscatter intensity be used to infer surface precipitation quantities?</strong></p><p>Well, we must find a way to extract very specific information about precipitation from only partially-related atmospheric variables of interest (which in this case is radar backscatter intensity). This can be accomplished in two ways:</p><ol><li>Through a physically-based model which simulates the physical processes occurring in the atmosphere resulting in the formation of ice crystals and eventually falling snow.</li><li>Empirical statistical processes (e.g. ML models) which can find patterns between disparate variables that display some sensitivity between one another through a forward model.</li></ol><p>While both techniques have their own sets of advantages and disadvantages which we <em>could</em> spend the entire blog post discussing, we will focus on the second method in this work. But first, what is a forward model<em>? </em>A classic illustration is provided in <em>Stephens, 1994</em>:</p><blockquote>“Suppose that you desire a description of a dragon but you observe only the footprints that the dragon makes in the sand. Now, if you already know the dragon, you can pretty easily describe the tracks it might make in the sand; i.e., you can develop a forward model. But if you observe only the tracks in the sand, it will be much more difficult to describe the dragon in any detail. You will likely be able to tell that it was a dragon and not a deer, but there will be aspects that you will be unable to characterize: the dragon’s color, if it has wings, etc. A retrieval can combine the observations (large footprints) with prior information (most dragons have wings and the ones making large footprints are green) to get the most likely state (it was a green dragon with wings).”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVYbgAeh0pGxbwz7B4OCNw.jpeg" /><figcaption>Dragon footprint in sand — Photo by <a href="https://www.gettyimages.ca/search/photographer?photographer=Vishy%20Patel%20%2F%20EyeEm">Vishy Patel</a> on <a href="https://www.gettyimages.ca/photos/dinosaur-footprint">Getty Images</a></figcaption></figure><p>We can use this idea to relate the information in the vertical radar profile to surface snowfall quantities! Since there is a physical structure to the radar data inputs (profiles reach from the surface up to about 3 km), multiple convolutional layers are employed by DeepPrecip to extract features between different portions of likely hydrometeor activity. This information helps our model understand different storm event types and structures which improves the accuracy of the intensity of the precipitation rate estimate in the fully connected feedforward regression component of the network.</p><p>More formally, the model architecture for DeepPrecip is shown below. Can you match different model architecture layers from this image to the earlier shown compute graph?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pvrqBxYmMw0nQqRkKLD4OQ.png" /><figcaption>DeepPrecip model architecture diagram — Image by Author</figcaption></figure><h4>Model Training</h4><p>In order to develop a robust model, we first need to gather a representative training dataset of radar data and collocated in situ precipitation measurement observations. Note that this is a supervised learning problem and therefore reference data is required.</p><p>As is always a challenge with problems in the Geosciences, care must be taken during the data selection phase to choose a representative sample. Each site must also be equipped with similar instruments calibrated in the same manner. In this work, we settled on 9 sites from across the northern hemisphere with 8 years of data collected from micro rain radar (MRR) systems and Pluvio2 gauges. Examples of these instruments are shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0gy442r-83nKzAj1aUsApQ.png" /><figcaption>MRR and Pluvio2 instruments and example reflectivity profiles — Image by Author</figcaption></figure><p>Due to the large size of the training dataset we curated (millions of training samples) coupled with the general complexity of the model architecture, hyperparameter optimization became a bottleneck for us early on in the development process. After experimenting with a variety of different cloud computing options, the systems at <a href="https://www.graphcore.ai/"><strong>Graphcore</strong></a> stood out as an excellent option for substantially improving our training times.</p><p>The key to this training speedup at Graphcore were the use of their specialized <a href="https://www.graphcore.ai/products/ipu">Intelligence Processing Units (IPUs)</a>. The IPU is a completely new kind of massively parallel processor to accelerate machine intelligence. The compute and memory architecture are designed for AI scale-out. Note the differences between IPUs and traditional processors below:</p><figure><img alt="Graphcore IPU processor differences" src="https://cdn-images-1.medium.com/max/1024/1*D_l3KInLg-WhRQe4TwjZ4g.png" /><figcaption>Differences between IPU architecture and other processor designs — Image by <a href="https://www.graphcore.ai/">Graphcore</a></figcaption></figure><p>The hardware is developed together with the software, delivering a platform that is easy to use and excels at real-world applications. Using a Graphcore MK2 Classic IPU-POD4 (note that a second-generation IPU is now available), we were able to <strong>speed up training times by a factor of</strong> <strong>6</strong> for DeepPrecip over other state-of-the-art systems (e.g. Tesla V100s). If you’d like to test IPU systems for your project, check out their <a href="https://www.graphcore.ai/ipus-in-the-cloud">cloud platform</a>.</p><figure><img alt="DeepPrecip training throughput comparisons" src="https://cdn-images-1.medium.com/max/1024/1*fGT5sVfBKyBYHWvsSCBxSQ.png" /><figcaption>Hardware throughput comparisons for DeepPrecip training — Image by Author</figcaption></figure><p>With the hardware selected, we then needed to select an optimization paradigm. In order to identify the optimal hyperparameter values for DeepPrecip, we decided to use a form of adaptive optimization known as <a href="https://jmlr.org/papers/volume18/16-558/16-558.pdf">hyperband optimization</a>. This method is a variation of Bayesian optimization (i.e. an adaptive search) which focuses on speeding up the random search process using adaptive resource allocation and early-stopping (<em>Li et al., 2018</em>). This allows us to test a vast hyperparameter space and quickly hone in on good values for our model parameters.</p><figure><img alt="Different hyperparameter optimization methods" src="https://cdn-images-1.medium.com/max/1024/1*2G7MHu6dLO1U3f049PsXqw.png" /><figcaption>Different hyperparameter optimization techniques — Image by <em>Talaat et al., 2022</em></figcaption></figure><p>Running a hyperband optimization of 14 different parameters for DeepPrecip with 68 different total value options (i.e. trillions of possible combinations) using a single IPU took approximately two weeks. Mean square error (MSE) metrics (below) show how this process was intelligently selecting better combinations of hyperparameters, while also slowly increasing the number of epochs each cycle.</p><figure><img alt="Hyperband MSE values" src="https://cdn-images-1.medium.com/max/1024/1*oGUeWsfCsfBft3izdYauUg.png" /><figcaption>Improvements in model skill from successive hyperband optimization steps — Image by Author</figcaption></figure><p>A high-dimensional visualization of these parameter relationships can be rendered using a parallel coordinate plot for each iteration (or index) of the hyperband optimization process (shown below). This allows us to find a balance between the complexity of the model architecture and performance to produce a model that is both efficient and skillful. For additional details on this process along with the final hyperparameter values, please see <em>King et al., 2022–2</em>.</p><figure><img alt="Parameter parallel coordinate plot" src="https://cdn-images-1.medium.com/max/1024/1*9dA7qnNtD7PENi9il1N7Xg.png" /><figcaption>Parallel coordinate plot of each hyperparameter combination — Image by Author</figcaption></figure><p>While the time invested in gathering, preprocessing and properly sampling the data combined with the 2-week hyperparameterization process may seem like overkill, it is extremely important to perform these steps properly, as it significantly reduces the chances of overfitting issues down the road.</p><h4>Performance &amp; Robustness</h4><p>With a fully trained model on our hands, we were able to assess its general performance against other ML models and traditional empirical relationships.</p><p>In general, DeepPrecip was found to outperform other traditional retrieval methods with <strong>40% lower MSE</strong> values and a <strong>40% improvement in R²</strong>. We also note that DeepPrecip appears much more capable of correctly estimating the peaks and troughs of high intensity precipitation compared to the other models tested. Using a cross-validation approach, we found that <strong>DeepPrecip demonstrates robustness</strong> with an improved ability to accurately predict precipitation quantities at sites with regional climates previously unseen by the model.</p><p>This last point about robustness is key. One of the major limitations of previous empirical methods was the fact that each model was bespoke for the climate in which it was derived (<em>Wood et al., 2014</em>). So while a model might work well in the northern USA, it might not perform well in Sweden, or in Korea, for instance.</p><p>A substantial benefit of an ML-based approach is that it can be trained on data from a variety of different locations in a manner which is unconstrained by physical assumptions of particle microphysics. We have found from this project that an ML-based solution to surface snowfall displays both low error and high generalizability and there is good reason to believe that a global ML retrieval algorithm could help enhance current satellite-based products that provide estimates of snowfall around the world.</p><figure><img alt="GPM Core satellite" src="https://cdn-images-1.medium.com/max/1024/1*XZGxBFC9EafG7cKMmIF2dg.jpeg" /><figcaption>Global Precipitation Measurement (GPM) Core satellite above a hurricane — Image by <a href="https://gpm.nasa.gov/missions/GPM/core-observatory">NASA</a></figcaption></figure><h4>Inference</h4><p>The goal at the start of this project was to not only develop an operational model, but to interpret said model to identify regions within the vertical radar profile that appear as the most significant contributors to high model skill.</p><p>DL models have commonly been considered “<em>black box</em>” algorithms, where some input is fed into the model and some output comes out; without much of an idea of what is happening in between these two stages. Some ML models like random forests provide a feature importance ranking based on the manner in which decisions are being made by each decision tree, but how can we extract something similar for a DL model like DeepPrecip?</p><p>Enter, <a href="https://christophm.github.io/interpretable-ml-book/shapley.html"><strong>Shapley values</strong></a>.</p><p>Introduced by (and named after) Lloyd Shapley<strong> </strong>in 1951, a Shapley value is a solution concept in cooperative game theory. This value represents the contribution to some shared goal in a game from an individual participant. With multiple players, it allows us to measure the marginal contribution of each player to the end result. For instance, if multiple people go out to eat for dinner and each person orders a different main course, if we then decide to split the dinner bill, the percentage each person pays can be split based on the Shapley value.</p><p>An visual diagram describing how local explanations from a large sample of observations can provide insights on global model behaviour using Shapley values is shown below for mortality risk assessment:</p><figure><img alt="Shapley tree explainer diagram" src="https://cdn-images-1.medium.com/max/1024/1*29CpD6c9AiYCNZ8ljRumaA.png" /><figcaption><em>Local explanations provide a wide variety of new ways to understand global model structure — Image by </em>Lundberg et al., 2020</figcaption></figure><p>This process for measuring local and global contributions to some goal can be related to DL using the method shown above and outlined in more detail in <em>Lundberg et al., 2020</em>. We can examine different combinations of model inputs (i.e. radar data subsets, or atmospheric variable combinations) to see how model accuracy changes. This can then be used to identify which variables, and which locations within the atmosphere in our case, provide the most important information for actively retrieving snowfall. Note that this is a very computationally expensive analysis to perform.</p><p>Breaking our dataset into different intensity precipitation event types and performing a Shapley analysis on each subset reveals the most important variables and regions (below; darker shaded regions indicate higher importance).</p><figure><img alt="Shapely value heatmap" src="https://cdn-images-1.medium.com/max/1024/1*2o7-EGRJMwpjlhsLd-9p8w.png" /><figcaption>Heatmap of Shapley values for each model predictor for each vertical bin above the surface — Image by Author</figcaption></figure><p>Interestingly, and perhaps unexpectedly, we find that DeepPrecip values areas in the mid-upper region of the atmosphere (near 2 km) as the most important contributors. Not just near surface bins. Typically, radar-based snowfall retrievals rely on information from a single (or handful) of near-surface bins, but that does not appear the be the case here. Additionally, reflectivity (RFL) is usually considered as the most important variable in radar-based retrievals, however Doppler Velocity (DOV) actually surpasses RLF in important for high intensity precipitation events. Note that SPW is spectral width, TMP is temperature and WVL is wind velocity.</p><p>Understanding how our DL model is making decisions is an important step for further optimizing its performance and improving its skill in future iterations. Further, the information revealed in this analysis could help to inform current and future snowfall retrievals for next-generation precipitation missions. If you are performing a similar experiment with DL, I would highly recommend testing this process out on your own model as these outputs can be quite illuminating!</p><h4>Summary &amp; Conclusions</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1fx1BIX17SE2ZZLJkMOcNA.png" /><figcaption>DeepPrecip project summary and next steps — Image by Author</figcaption></figure><p>In this work, we briefly describe the development process of DeepPrecip: a novel deep learning snowfall retrieval algorithm using vertical reflectivity profiles. While we don’t discuss the code for DeepPrecip here, the model is open source and available for use on GitHub. It was developed in Python using <a href="https://scikit-learn.org/stable/">scikit-learn</a>, <a href="https://www.tensorflow.org/">Tensorflow</a> and <a href="https://keras.io/">Keras</a>.</p><p><a href="https://github.com/frasertheking/DeepPrecip">GitHub - frasertheking/DeepPrecip: A deep convolutional neural network for surface precipitation retrievals</a></p><p>If you are interested in testing things out, the model can be built and run using the following commands:</p><pre>git clone <a href="https://github.com/frasertheking/DeepPrecip.git">https://github.com/frasertheking/DeepPrecip.git</a><br>conda env create -f req.yml<br>conda activate deep_precip<br>python deep_precip.py</pre><p>We also include a <a href="https://github.com/frasertheking/DeepPrecip/blob/main/deep_precip_ipu.py">deep_precip_ipu.py</a> module for running this model on <a href="https://www.graphcore.ai/graphcloud">Graphcore IPUs</a>. Note that you will need MRR training data to feed as an input to the model.</p><p>I’ll conclude this post by saying that I don’t expect DL models to completely replace physical models or traditional empirical methods for snowfall retrievals. However, the high accuracy and robustness of a DL approach, combined with the insights provided from global model behaviour analyses can help to <strong>enhance and inform future snowfall retrieval methods for both surface and spaceborne radar missions</strong>.</p><p>For more specifics on this project, please read our paper currently in review at Atmospheric Measurement Techniques (AMT)(<a href="https://egusphere.copernicus.org/preprints/2022/egusphere-2022-497/">https://egusphere.copernicus.org/preprints/2022/egusphere-2022-497/</a>).</p><p>Further, if you’d like to support our work, we are finalists in the NSERC Science Exposed contest, and would appreciate your support by <a href="http://www.nserc-crsng.gc.ca/ScienceExposed-PreuveParLimage/past_winners-images_des_gagnants_eng.asp?year=2022#img-7"><strong>voting for our image</strong></a>.</p><h4>Acknowledgements</h4><p>I’d like to thank the many data providers who contributed years of observations to this work, my coauthors, the University of Waterloo as well as the Graphcore team for their continued support and access to their computing systems.</p><p>I would also like to thank the Natural Sciences and Engineering Research Council of Canada (NSERC) for funding this project.</p><h4>References:</h4><p>Ashouri, Hamed, Gehne, Maria &amp; National Center for Atmospheric Research Staff (Eds). Last modified 31 Oct 2021. “The Climate Data Guide: PERSIANN-CDR: Precipitation Estimation from Remotely Sensed Information using Artificial Neural Networks — Climate Data Record.”</p><p>Dramsch, J. S. (2020). 70 years of machine learning in geoscience in review. <em>Advances in Geophysics</em>, <em>61</em>, 1–55. <a href="https://doi.org/10.1016/bs.agph.2020.08.002">https://doi.org/10.1016/bs.agph.2020.08.002</a></p><p>Gray, D. M. ed, &amp; Male, D. H. ed. (1981). <em>Handbook of snow: Principles, processes, management &amp; use</em>. Pergamon Press. <a href="https://snia.mop.gob.cl/repositoriodga/handle/20.500.13000/2981">https://snia.mop.gob.cl/repositoriodga/handle/20.500.13000/2981</a></p><p>IPCC, 2019: IPCC Special Report on the Ocean and Cryosphere in a Changing Climate [H.-O. Pörtner, D.C. Roberts, V. Masson-Delmotte, P. Zhai, M. Tignor, E. Poloczanska, K. Mintenbeck, A. Alegría, M. Nicolai, A. Okem, J. Petzold, B. Rama, N.M. Weyer (eds.)]. Cambridge University Press, Cambridge, UK and New York, NY, USA, 755 pp. h<a href="https://doi.org/10.1017/9781009157964.">ttps://doi.org/10.1017/9781009157964.</a></p><p>King, F., Duffy, G., &amp; Fletcher, C. G. (2022). A Centimeter Wavelength Snowfall Retrieval Algorithm Using Machine Learning. <em>Journal of Applied Meteorology and Climatology</em>, <em>1</em>(aop). <a href="https://doi.org/10.1175/JAMC-D-22-0036.1">https://doi.org/10.1175/JAMC-D-22-0036.1</a></p><p>King, F., Duffy, G., Milani, L., Fletcher, C. G., Pettersen, C., &amp; Ebell, K. (2022). DeepPrecip: A deep neural network for precipitation retrievals. <em>EGUsphere</em>, 1–24. <a href="https://doi.org/10.5194/egusphere-2022-497">https://doi.org/10.5194/egusphere-2022-497</a></p><p>Krumbein, W. C., &amp; Dacey, M. F. (1969). Markov chains and embedded Markov chains in geology. <em>Journal of the International Association for Mathematical Geology</em>, <em>1</em>(1), 79–96. <a href="https://doi.org/10.1007/BF02047072">https://doi.org/10.1007/BF02047072</a></p><p>Li, L., Jamieson, K., DeSalvo, G., Rostamizadeh, A., &amp; Talwalkar, A. (2018). <em>Hyperband: A Novel Bandit-Based Approach to Hyperparameter Optimization</em> (arXiv:1603.06560). arXiv. <a href="https://doi.org/10.48550/arXiv.1603.06560">https://doi.org/10.48550/arXiv.1603.06560</a></p><p>Lundberg, S. M., Erion, G., Chen, H., DeGrave, A., Prutkin, J. M., Nair, B., Katz, R., Himmelfarb, J., Bansal, N., &amp; Lee, S.-I. (2020). From local explanations to global understanding with explainable AI for trees. <em>Nature Machine Intelligence</em>, <em>2</em>(1), 56–67. <a href="https://doi.org/10.1038/s42256-019-0138-9">https://doi.org/10.1038/s42256-019-0138-9</a></p><p>Musselman, K. N., Addor, N., Vano, J. A., &amp; Molotch, N. P. (2021). Winter melt trends portend widespread declines in snow water resources. <em>Nature Climate Change</em>, <em>11</em>(5), 418–424. <a href="https://doi.org/10.1038/s41558-021-01014-9">https://doi.org/10.1038/s41558-021-01014-9</a></p><p>Newendorp, P. D. (1976). <em>Decision analysis for petroleum exploration</em>. <a href="https://www.osti.gov/biblio/6406439">https://www.osti.gov/biblio/6406439</a></p><p>Preston, Floyd W., and James Henderson. <em>Fourier series characterization of cyclic sediments for stratigraphic correlation</em>. Kansas Geological Survey, 1964.</p><p>Stephens, G. L., 1994: <em>Remote Sensing of the Lower Atmosphere: An Introduction. </em>Oxford University Press, 562 pp.</p><p>Sturm, M., Goldstein, M. A., &amp; Parr, C. (2017). Water and life from snow: A trillion dollar science question. <em>Water Resources Research</em>, <em>53</em>(5), 3534–3544. <a href="https://doi.org/10.1002/2017WR020840">https://doi.org/10.1002/2017WR020840</a></p><p>Talaat, F. M., &amp; Gamel, S. A. (2022). RL based hyper-parameters optimization algorithm (ROA) for convolutional neural network. <em>Journal of Ambient Intelligence and Humanized Computing</em>. <a href="https://doi.org/10.1007/s12652-022-03788-y">https://doi.org/10.1007/s12652-022-03788-y</a></p><p>Wood, N. B., L’Ecuyer, T. S., Heymsfield, A. J., Stephens, G. L., Hudak, D. R., &amp; Rodriguez, P. (2014). Estimating snow microphysical properties using collocated multisensor observations. <em>Journal of Geophysical Research: Atmospheres</em>, <em>119</em>(14), 8941–8961. <a href="https://doi.org/10.1002/2013JD021303">https://doi.org/10.1002/2013JD021303</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89b5036ae324" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/do-neural-networks-dream-of-falling-snow-89b5036ae324">Do Neural Networks Dream of Falling Snow?</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>