<?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[Accel.AI - Medium]]></title>
        <description><![CDATA[Accelerating AI for Social Impact - Medium]]></description>
        <link>https://medium.com/accel-ai?source=rss----e39925390279---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Accel.AI - Medium</title>
            <link>https://medium.com/accel-ai?source=rss----e39925390279---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:06:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/accel-ai" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Implement OCR Tools with Cloud Vision API in Google Apps Script]]></title>
            <link>https://medium.com/accel-ai/how-to-implement-ocr-tools-with-cloud-vision-api-in-google-apps-script-40a349329450?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/40a349329450</guid>
            <category><![CDATA[google-apps-script]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[cloud-vision-api]]></category>
            <category><![CDATA[text-recognition]]></category>
            <category><![CDATA[ocr]]></category>
            <dc:creator><![CDATA[María Guerra]]></dc:creator>
            <pubDate>Wed, 25 Jun 2025 22:58:28 GMT</pubDate>
            <atom:updated>2025-07-02T02:08:27.386Z</atom:updated>
            <content:encoded><![CDATA[<h4>In this article, we’ll explore how to bring OCR (Optical Character Recognition) technology into your Google Apps Script projects using Google’s Cloud Vision API. Don’t worry if you’re new to this; we’ll walk through the setup step-by-step, from configuring your cloud projects to writing the scripts that can read text from images and PDFs. Whether you want to automate data entry or just learn more about how OCR works, you’ll find easy-to-follow instructions and practical tips to get started. Let’s dive in!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*TNmhgbA58CoGoCGl" /></figure><p>Optical Character Recognition (OCR), which is often referred to as text recognition, converts images into digitally encoded text using specialized software, which enables a computer to convert a scanned document, a digital photo of text, or any other digital text image into machine-readable and editable data. This process is mainly used for text and/or data mining projects, textual comparisons, and is an important resource for creating accessible documents for blind and visually impaired persons (Russel, 2023).</p><p>This technology became popular in the early 1990s, as it was used to digitize historical newspapers, and ever since then it has undergone several improvements, with OCR software nowadays taking advantage of artificial intelligence to implement more advanced methods of intelligent character recognition (ICR) for identifying languages or handwriting (IBM, 2024).</p><h3>How does OCR work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xUNyPJwi-a3aismM" /><figcaption>Source: <a href="https://www.highradius.com/resources/Blog/3-steps-to-measuring-effectiveness-of-ocr-and-cash-application-automation/">HighRadius</a></figcaption></figure><p>According to IBM (2024), there are 5 steps for OCR Processing:</p><p><strong>1. Image acquisition: </strong>All document pages are copied and converted into a two-color or black-and-white version. The scanned-in image is analyzed for the program to identify the dark portions as characters that need to be recognized, and the light areas as background.</p><p><strong>2. Preprocessing: </strong>The digital image is cleaned to remove irrelevant pixels.</p><p><strong>3. Text recognition: </strong>The dark portions are processed to find alphabetic letters, numeric digits or symbols. The characters are then identified by using one of two algorithms: pattern recognition or feature recognition.</p><ul><li>Pattern recognition: This algorithm is used when the OCR program has previously been trained on examples of text in various fonts and formats to recognize characters by comparison. For this to work, the characters must be in a font that the OCR program has already been trained on, and because of this, pattern recognition works well only when the document is typed and it’s hard to use for handwritten documents.</li><li>Feature recognition (detection or extraction): It applies rules regarding the features of a specific letter or number to recognize characters in the scanned document. Features include the number of angled lines, line intersections, loops or curves in a character.</li></ul><p><strong>4. Layout recognition: </strong>A more complete OCR program will also analyze the structure of a document image, where it divides the page into elements, such as blocks of text, tables or images. The lines are divided into words and then into characters. After the characters have been singled out, the program compares them with a set of pattern images and then returns the recognized text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V6s9FcisDC1_2tSq" /><figcaption>Source: <a href="https://www.docuclipper.com/blog/ocr/">DocuClipper</a></figcaption></figure><p><strong>5. Postprocessing:</strong> Here, the OCR software further checks for accuracy to avoid any errors. The gathered information is then stored as a digital file, either in an editable form or PDF.</p><h3>Real-world use cases</h3><p>For a real-life example of OCR, one could say that our eyes are an optical mechanism, with the images seen by our eyes being the input for our brain. Although OCR cannot compete with human reading capabilities, this kind of technology functions similarly to our ability to read.</p><p>According to IBM (2024), the most well-known use case for OCR is converting printed paper documents into machine-readable text documents, which can accelerate workloads in many industries, including education, finance, healthcare, logistics, and transportation, processing and retrieving loan documents, labels, invoices, and receipts.</p><p>For example, banking and financial businesses utilize OCR technology to process data from cheques, bank statements, or to verify account numbers and transaction details. Meanwhile, healthcare organizations can use it to transcribe patients’ records, insurance claims, and pre-authorization forms.</p><p>Some lesser-known use cases include data-entry automation, assisting blind and visually impaired persons, and indexing documents for search engines, such as passports, license plates, and invoices.</p><h3>Other OCR Tools</h3><p>Since we are going to be working with Google Cloud AI to implement OCR, let’s also talk a little bit about other well-known APIs used for optical character recognition.</p><h4><strong>Tesseract</strong></h4><p>Being on the market as an open-source engine since 2005 (and developed by Google), makes Tesseract one of the most well-known OCR tools. It supports more than 100 languages and can be trained to recognize more, has AI integration to detect different text sizes, and supports multiple output formats. Tesseract can also be used as a command line program and has a library for developers to build their own applications. All Tesseract installation files can be found in its official GitHub repository, which is free for all users.</p><h4><strong>Amazon Textract</strong></h4><p>Amazon Textract uses machine learning to read, process and extract text from any document without having to do any manual configuration or needing ML expertise to use it, since it includes simple API operations to help analyze images and PDF files. It also offers pretrained and custom features to automate document processing, so it can be adjusted to specific needs. Unlike Tesseract, Amazon Textract uses custom pricing: you only pay for the documents you analyze.</p><h4><strong>IBM Automation Document Processing</strong></h4><p>This software combines AI with deep learning and low-code tooling to get rid of manual document processing for large volumes of unstructured data. The IBM Automation Document Processing (ADP) is a component included in the IBM Cloud Pak for Business Automation, which has many other automation capabilities and is mostly used by enterprises. ADP services are containerized and can run on local (on-premise) or cloud (private, public or hybrid) infrastructure, where you can run the IBM Cloud Pak.</p><h4><strong>Adobe Acrobat Pro</strong></h4><p>Adobe’s OCR tool applies text recognition algorithms to analyze images as they are scanned into Acrobat or by opening already existing files without having to install additional software, since it can be used from any browser. It is said to be a more pervasive software since it is less academic and more business-oriented.</p><h3>Apps Script and Google Cloud project setup</h3><p>A fundamental concept that can be found in the official documentation is: “Every Apps Script project uses Google Cloud to manage authorization, advanced services, and other details”. Because of this, we’ll need to create 2 new projects: an <a href="http://script.google.com/">Apps Script project</a> and a <a href="https://console.cloud.google.com/">Google Cloud project</a>. When we first create a project inside Apps Script, it’s automatically linked to a default Google Cloud project (that you never see or adjust), but since we will need to make some adjustments to implement OCR with Google Cloud AI, we need to have our own standard Cloud project.</p><p>For this tutorial, I’m going to be using Apps Script from a spreadsheet in Google Sheets. First, create a new spreadsheet, go to the “Extensions” tab, and click on “Apps Script”; this will automatically create and open an Apps Script project linked to that same spreadsheet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/0*CNHl2lkKeQ9FQY2K" /></figure><p>This spreadsheet will have the links to the documents and images where we will be applying OCR to.</p><p>To create a Google Cloud project, just go to the <a href="https://console.cloud.google.com/">Cloud Console</a> and create a new project.</p><p>After creating both projects, linking them together is easy. We have to go to our Apps Script settings and scroll down a bit to see the “Google Cloud Platform (GCP) Project” section. Here we will click the “Change Project” button and input our Cloud project number.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/0*6gf6mp0b88lJy-B8" /></figure><p>To get the project number, just go to your Google Cloud dashboard and look for the “Project info” section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/0*DSvpqCIci5qcaVEW" /></figure><h4><strong>Google Cloud Project settings</strong></h4><ul><li><strong>Billing</strong></li></ul><p>First of all, make sure to have a functioning billing account linked to your project. The code we will be working on will not consume any credits, but the billing account is needed to use the Cloud Vision API. You can set this up by going to the navigation menu and clicking on the “Billing” option.</p><ul><li><strong>Authorization</strong></li></ul><p>To make API calls to Google Cloud, we have to authorize Cloud Shell first. You can do this by clicking the Cloud Shell icon in the right corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*oCOoW_OF71MCWllg" /></figure><p>The Cloud Shell terminal will open with a dialog, click “Authorize” (It might tell you to log in with your Google account after).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3YNp-vtksvTqpmQV" /></figure><p>Another way to do this would be by <a href="https://cloud.google.com/sdk/docs/install">installing</a> the Google Cloud CLI and running the command: <a href="https://cloud.google.com/sdk/gcloud/reference/auth/login"><strong>gcloud auth login</strong></a></p><ul><li><strong>Credentials</strong></li></ul><p>If you are working on a brand new Cloud project like me, we will need to configure the consent screen, which shouldn’t take more than 5 minutes. Go to the navigation menu, under the “APIs &amp; Services” option, and look for “Credentials”. Here you will see a warning pop up telling you to configure the OAuth consent screen, click the button and fill out the information depending on your type of project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ePXgcTuly-xG-IPb" /></figure><p>To make calls to the Cloud Vision API, we’ll need an API Key, so let’s create it. In the “Credentials” page, click on “+ Create credentials” and then “API Key”. This will automatically create an API Key for us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/0*Eh1JO4TrY9FsLIcp" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*EaLwT0NhtSNCefgP" /></figure><p>As the warning below says, the key we just created is currently unrestricted. You can edit its restrictions if needed in the “Edit API Key” menu.</p><ul><li><strong>Enabling APIs</strong></li></ul><p>To enable the APIs we will be using, go to your cloud project navigation menu and click the option “Enabled APIs &amp; services” and then click the “+ Enable APIs and services” button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*7SL8TmqZPhbF-FGT" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q7vRfDC3o1blERa0" /></figure><p>You will now see the API Library, where we will search for and enable the following APIs:</p><ul><li>Cloud Vision API</li><li>App Script API</li><li>Google Drive API</li><li>Google Sheets API</li><li><strong>Creating and setting up a service account</strong></li></ul><p>According to Google’s documentation, “A service account is a special kind of account typically used by an application or compute workload, such as a Compute Engine instance, rather than a person. (…) Applications use service accounts to make authorized API calls by authenticating as either the service account itself, or as Google Workspace or Cloud Identity users.”</p><p>We’ll be using a service account to make a certain type of call to the Cloud Vision API. To create one, go to “IAM &amp; Admin” in the navigation menu, and click on “Service accounts”, there you will see the “+ Create Service Account” button.</p><p>The first step will be giving a name and description to your service account, and once you click “Create and continue,” we will grant the service account a role in our project. In our case, this service account will have 2 roles: “Cloud Vision AI Service Agent” and also “Storage Object Viewer”. To add the second role, just click on “+ Add another role”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/0*JzI9Bb-Uws1OMX4o" /></figure><p>If you want a specific user to have access to this service account, the third step allows you to do this. I’ll just leave it blank since it’s not necessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/0*_Jc_OEk0QlZUAMIj" /></figure><p>Now that we have created our service account, we need a key to use it in our code. To get this key, click on the three dots under “Actions” to display the menu, and click on “Manage keys”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SA6WsJs220r2uFPp" /></figure><p>Go to the “Add key” button, and click “Create new key”. It will then ask you for the key type, select JSON.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/0*46fpgc6skkl1yqk-" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/0*mVnA48lqPmBJ0ElF" /></figure><p>It will automatically download a JSON file for you. We’ll need that file for later in the code, so make sure to rename it with a clear and identifiable name.</p><h4><strong>Apps Script Setup</strong></h4><p>First, go to the project settings and enable the option “Show “appsscript.json” manifest file in editor”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*trtaS-yOfNbVOmVO" /></figure><p>Back in the Editor, we will see the new appsscript.json file. Here we will be adding the following scopes:</p><pre>&quot;oauthScopes&quot;: [<br>    &quot;https://www.googleapis.com/auth/script.external_request&quot;,<br>    &quot;https://www.googleapis.com/auth/devstorage.read_write&quot;,<br>    &quot;https://www.googleapis.com/auth/drive.readonly&quot;,<br>    &quot;https://www.googleapis.com/auth/spreadsheets&quot;,<br>    &quot;https://www.googleapis.com/auth/cloud-platform&quot;<br>  ]</pre><p>Your appsscript.json file now should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/0*1LLIqqmyyVOmG5wL" /></figure><p>And with that, we have finished the project setup. Now, let’s dive into the implementation 🤓.</p><h3>Detect text in images</h3><p>If you try to follow<a href="https://cloud.google.com/vision/docs/ocr#vision_text_detection-drest"> Google’s documentation</a>, you will notice that they only have the implementation for the gcloud console or programming languages like Go, Java, Python, and Node.js. At first, I thought that the Cloud Vision API could be found as a service inside of Apps Script, but it’s actually not an option. That’s why we will have to follow the REST implementation, but modify it to work on Apps Script since we won’t be using curl or PowerShell to send the request.</p><p>We’ll use a very basic example: In a spreadsheet, we will have a column of images as Google Drive links, and the script will extract the text of every image and paste it in another column, something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/0*21gOXlhhvdEruHRL" /></figure><p><a href="https://docs.google.com/spreadsheets/d/16STi-EbN3NIq-cIgVRXKsc37ibIu4TmGP4MOWlKljXo/edit?usp=sharing">Here you can find the link to the spreadsheet I used</a>. By going to the menu tab “Extensions” and clicking on “Apps Script” you should be able to see the project that contains all the code from this tutorial.</p><h4><strong>Implementation in Apps Script</strong></h4><p>We will be using the first API key we created, you can find it on the “Credentials” page under “APIs &amp; Services” on the navigation menu.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5dvGk375W3lgOYM9" /></figure><p>Let’s save that API key as a Script Property in our project. Go to “Settings”, scroll down to the very last section and click on “Add script property”. I’ll be saving it as “API_KEY”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/0*P0HYEQOsFjHY4Jp4" /></figure><p>Now, I’ll rename the file called “Code” to “Main” and create 2 new script files called “Images” and “Utils”, just to have a more organized code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/0*mV7l0uepYzvuyu0i" /></figure><p>In the Utils.gs file, we will have the following functions to help us get the Google Drive links from our spreadsheet and validate them:</p><pre>/**<br> * Extracts the values from a specified range in a sheet.<br> * This function dynamically calculates the range to extract values from based on<br> * the starting row, the total number of columns, and identifies the last row<br> * containing data. It skips blank rows at the end of the data.<br> *<br> * @param {Object} sheet - The sheet object to extract data from.<br> * @param {number} startingRow - The starting row index (1-based).<br> * @param {number} numColumns - The number of columns to include in the range.<br> * @returns {Array&lt;Array&lt;any&gt;&gt;} - A 2D array containing the values from the specified range.<br> */<br>function getTable(sheet, startingRow, numColumns) {<br>  var data = sheet.getDataRange().getValues();<br>  var lastRow = data.length; // Default to the total number of rows in the sheet<br>  // Loop through rows starting from the starting row<br>  for (var i = startingRow - 1; i &lt; data.length; i++) { // `startingRow - 1` because `data` is 0-indexed<br>    if (data[i].join(&quot;&quot;).trim() === &quot;&quot;) { // Check if the entire row is blank<br>      lastRow = i; // Set the last row to the current row<br>      break;<br>    }<br>  }<br>  // Get the range dynamically<br>  var range = sheet.getRange(startingRow, 1, lastRow - startingRow + 1, numColumns);<br>  var values = range.getValues(); // Get the values from the dynamic range<br>  return values;<br>}<br><br><br>/**<br> * Extracts the file ID from a Google Drive file URL.<br> * @param {string} url - The URL of the Google Drive file.<br> * @returns {string} - The extracted file ID.<br> */<br>function extractFileId(url) {<br>  var validate = isValidDriveLink(url);<br> <br>  if (validate === true) {<br>    const match = url.match(/[-\w]{25,}/); // Google Drive file IDs are 25+ characters<br>    return match[0];<br>  } else {<br>    throw new Error(&#39;Invalid Google Drive URL&#39;);<br>  }<br>}<br><br><br>/**<br>  * Validates Google Drive links.<br>  * @param {string} url - The URL of the Google Drive file.<br>  * @returns {string/boolean} - Returns a &quot;true&quot; boolean value or an error message.<br>  */<br>function isValidDriveLink(url) {<br>  if (url === &quot;&quot;){<br>    Logger.log(&quot;Missing URL&quot;);<br>    return &quot;Missing URL&quot;<br>  }<br>  // Regular expression to extract the Google Drive file ID<br>  const regex = /(?:drive\.google\.com\/(?:file\/d\/|open\?id=)|docs\.google\.com\/\w+\/d\/)([a-zA-Z0-9_-]{33,})/;<br>  const match = url.match(regex);<br><br><br>  if (!match) {<br>      Logger.log(&quot;Invalid URL format.&quot;);<br>      return &quot;Invalid URL format.&quot;; // URL is not a valid Google Drive link<br>  }<br><br><br>  const fileId = match[1];<br>  try {<br>      // Try to access the file<br>      const file = DriveApp.getFileById(fileId);<br>  } catch (e) {<br>      Logger.log(&quot;Error: &quot; + e.message);<br>      Logger.log(&quot;File not found or access restricted.&quot;);<br>      return &quot;File not found or access restricted.&quot;; // File is either non-existent or permission is restricted<br>  }<br>  return true;<br>}</pre><p>The Images.gs file will contain our <strong>extractTextFromImage </strong>function, where we will call the Cloud Vision API to obtain the extracted text from an image blob.</p><pre>function extractTextFromImage(blob){<br>  try {<br>    const base64Image = Utilities.base64Encode(blob.getBytes());<br>    var APIKey = PropertiesService.getScriptProperties().getProperty(&#39;API_KEY&#39;);<br>    // Make a POST request to Vision API with a JSON payload.      <br>    var visionApiUrl = &#39;https://vision.googleapis.com/v1/images:annotate?key=&#39; + APIKey;<br><br><br>    var JSON_REQ = buildJSONRequestImages(base64Image);<br><br><br>    var options = {<br>      &#39;method&#39;: &#39;POST&#39;,<br>      &#39;contentType&#39;: &#39;application/json&#39;,<br>      &#39;payload&#39;: JSON_REQ<br>    };<br><br><br>    var response = UrlFetchApp.fetch(visionApiUrl, options).getContentText();<br>    var text = JSON.parse(response)<br>   <br>    return text.responses[0].fullTextAnnotation.text;<br>  } catch (error) {<br>    Logger.log(`Error processing link: ${error.message}`);<br>  }<br>}<br><br><br>function buildJSONRequestImages(base64Image) {<br>  return JSON.stringify({<br>    requests: [{<br>      image: {<br>            content: base64Image,<br>          },<br>      features: [{<br>        type: &quot;DOCUMENT_TEXT_DETECTION&quot;,<br>        maxResults: 1<br>      }]<br>    }]<br>  });<br>}</pre><p>And lastly, in our Main.gs file, we will first call the <strong>getTable </strong>function from our Utils.gs file to get the data from our spreadsheet according to the starting row index (2) and the number of columns (1) we want to extract. Then, we will use the <strong>extractTextFromImage </strong>Function inside a loop to go through the data array, making sure to check the type of file beforehand, since the spreadsheet will include both images and PDF files.</p><pre>function detectTextWithOCR() {<br>  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();<br>  const data = getTable(sheet, 2, 1);<br><br><br>  for (var i = 0; i &lt; data.length; i++) {<br>    var link = data[i][0];<br>    const fileId = extractFileId(link);<br>    const file = DriveApp.getFileById(fileId);<br>    const fileType = file.getMimeType();<br><br><br>    if (fileType.includes(&quot;image&quot;)){<br>      var text = extractTextFromImage(file.getBlob());<br> if (text){<br>        Logger.log(&quot;Text extracted successfully&quot;)<br>      }<br>      sheet.getRange(&quot;B&quot;+ (i+2)).setValue(text);<br>    }<br>  }  <br>}</pre><p>To see the code in action, first we will need to add the images we want to process as Google Drive links on the spreadsheet we created. And make sure the links have public access!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*78asKhNJj-EYR41v" /></figure><p>To compile the code, simply click the “Run” button in our Apps Script project. Alternatively, you can add the following code snippet to the Utils.gs file to create a new tab menu, allowing you to run the code directly from the spreadsheet.</p><pre>function onInstall(e){<br>  onOpen(e);<br>}<br><br><br>function onOpen(e){<br>  var ui = SpreadsheetApp.getUi();<br>  ui.createMenu(&#39;OCR Tool&#39;)<br>  .addItem(&#39;Extract Text&#39;, &#39;detectTextWithOCR&#39;)<br>  .addToUi();<br>}</pre><p>It should show up like this. And if it doesn’t, try running the code once from the Apps Script project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tYeKK3i8Ydcbiba6" /></figure><h3>Detect text in PDFs</h3><p>You might have noticed that detecting text in images doesn’t require us to do many steps inside our code. Well, for PDF files is a completely different story.</p><p>You can find the more detailed steps in the <a href="https://cloud.google.com/vision/docs/pdf#vision_text_detection_pdf_gcs-drest">official documentation</a>, but there are a few things that work very differently inside Apps Script. I noticed this when I was working on a project using the Cloud Vision API for the very first time, so this entire step-by-step is thanks to a lot of trial and error 🤓.</p><p>When I first tried doing a<strong> files:asyncBatchAnnotate </strong>request using the same API key from before, It failed. Then I noticed that the authentication section of the documentation says the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f6SaaysZVaAJSNck" /></figure><p>This is the reason why we needed to create a service account, but when clicking on the link for the instructions on the authentication, the documentation it’s not that helpful, even less for our implementation in Apps Script. So, in the code I will be showing you a function for generating this OAuth2 access token and authenticating with Google Cloud services using a service account.</p><p>Also, we will have to store the PDF files in Google Cloud Storage in order to use the OCR request, since it uses a path to a file in a Cloud Storage bucket instead of base 64 encoding like it did for the images.</p><p>Now, let’s summarize the steps we have to follow for this process:</p><ol><li>Add the PDF file we want to analyze to our Cloud Storage.</li><li>Get an access token using a service account.</li><li>Send the request to the Cloud Vision API.</li><li>Use the operation ID from the previous request to retrieve the Vision annotation response.</li><li>Check if the operation has been completed.</li><li>When completed, retrieve the output file that was written to Cloud Storage as text.</li><li>Delete all used files from Cloud Storage.</li></ol><h4><strong>Implementation in Apps Script</strong></h4><p>Before we start, make sure to create and set up a bucket in your Cloud Storage inside our Google Cloud project. Go to the navigation menu and search for Cloud Storage, click on the Buckets option, and then the “+ Create” button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dlwpwqY-z_X2SbZf" /></figure><p>Your bucket’s name will serve as an ID in our code, so choose a clear and easily recognizable name. Below are the settings for the bucket I created for this tutorial:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/0*xa3MciICIv91HhWs" /></figure><p>To make the writing and deletion of files from Apps Script work, remember to give your storage bucket <strong>fine-grained access control</strong> and also give the service account <strong>storage object viewer permissions</strong> (we did this when first creating our service account).</p><p>Now, let’s add new script properties to our project. This time, we’ll be storing the JSON key we got back when we first created our service account and also the name we gave to our Cloud Storage bucket.</p><p>For the service account key, open the JSON file (you can use Windows Notepad or any other text editor) and copy all of its contents. Go to the script properties section in project settings, add a new property, and paste the JSON file contents as the value and give it a name. I’ll be naming it “SERVICE_ACC_KEY”.</p><p>And for the Cloud Storage bucket, I’ll be using “BUCKET_NAME” as the property name. The value should be the same as the name of the bucket we just created.</p><p>Your script properties should now look something like this. Don’t forget to save the changes!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AWGvblyuEP_Lyz8s" /></figure><h4>Now we are ready to start coding 🧑🏽‍💻</h4><p>First, I’ll be creating a new script file called “PDFs” for most of the new code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/0*KhA7Jch0FhLRdnGk" /></figure><p>In there, we will have the following functions:</p><pre>/**<br> * Extracts text from a PDF file using Google&#39;s Vision API.<br> *<br> * @param {File} file - The PDF file to process.<br> * @param {Blob} blob - The file blob for storage operations.<br> * @returns {string|null} The extracted text from the PDF, or null if an error occurs.<br> */<br>function extractTextFromPDF(file) {<br>  var blob = file.getBlob();<br>  // Upload the file to cloud storage under the specified bucket<br>  const BUCKET_NAME = PropertiesService.getScriptProperties().getProperty(&#39;BUCKET_NAME&#39;);<br>  var resource = addFileToCloudStorage(blob, BUCKET_NAME, file.getName());<br><br><br>  if (resource) {<br>    // Define the Vision API endpoint for asynchronous PDF text detection<br>    var visionApiUrl = &#39;https://vision.googleapis.com/v1/files:asyncBatchAnnotate&#39;;<br>   <br>    // Construct the JSON request payload for the API call<br>    const JSON_REQ = buildJSONRequestPDFs(file.getName(), BUCKET_NAME);<br>   <br>    // Obtain the authentication token required for the API request<br>    const ACCESS_TOKEN = getAccessToken();<br><br><br>    // Configure request options<br>    var options = {<br>      &#39;method&#39;: &#39;POST&#39;,<br>      &#39;contentType&#39;: &#39;application/json&#39;,<br>      &#39;headers&#39;: {<br>        &quot;Authorization&quot;: &quot;Bearer &quot; + ACCESS_TOKEN<br>      },<br>      &#39;payload&#39;: JSON_REQ,<br>      &#39;muteHttpExceptions&#39;: true, // Avoid throwing HTTP errors<br>    };<br><br><br>    // Send the request and capture the response<br>    var response = UrlFetchApp.fetch(visionApiUrl, options).getContentText();<br>    Logger.log(response);<br><br><br>    // Extract the operation name from the response for tracking progress<br>    var operationName = JSON.parse(response).name;<br>    const delayMs = 3000; // Delay time between API status checks<br><br><br>    // Extract the operation ID for checking completion status<br>    const operationId = operationName.split(&#39;/&#39;).pop();<br>    const url = `https://vision.googleapis.com/v1/operations/${operationId}`;<br><br><br>    var result = {done: false};<br><br><br>    // Loop until the text extraction process is completed<br>    while (!result.done) {<br>      try {<br>        // Fetch the operation status using the stored operation ID<br>        const response = UrlFetchApp.fetch(url, {<br>          method: &#39;GET&#39;,<br>          headers: {<br>            &quot;Authorization&quot;: &quot;Bearer &quot; + ScriptApp.getOAuthToken()<br>          }<br>        });<br><br><br>        const result = JSON.parse(response.getContentText());<br><br><br>        // Check if the operation is completed<br>        if (result.done) {<br>          // Retrieve the extracted text from the output file<br>          var output = getOutputFileAsText(BUCKET_NAME);<br><br><br>          // Delete individual output files after extraction to clean up storage<br>          output.pageNumbers.map((n) =&gt; {<br>            deleteFileFromCloudStorage(BUCKET_NAME, `output-${n}-to-${n}.json`);<br>          });<br><br><br>          // Remove the original PDF file from cloud storage<br>          deleteFileFromCloudStorage(BUCKET_NAME, file.getName());<br><br><br>          return output.text; // Return the extracted text<br>        }<br><br><br>        console.log(`Operation still in progress...`);<br>        Utilities.sleep(delayMs); // Wait before retrying<br>      } catch (error) {<br>        // Log and return null if an error occurs during API calls<br>        console.error(&#39;Error fetching Vision API response:&#39;, error);<br>        return null;<br>      }<br>    }<br>  } else {<br>    return null; // Return null if file upload to cloud storage fails<br>  }  <br>}<br><br><br>function buildJSONRequestPDFs(fileName, BUCKET_NAME){<br>  return JSON.stringify({<br>  requests:[<br>      {<br>        inputConfig: {<br>          gcsSource: {<br>            uri: `gs://${BUCKET_NAME}/` + fileName<br>          },<br>          mimeType: &quot;application/pdf&quot;<br>        },<br>        features: [<br>          {<br>            type: &quot;DOCUMENT_TEXT_DETECTION&quot;<br>          }<br>        ],<br>        outputConfig: {<br>          gcsDestination: {<br>            uri: `gs://${BUCKET_NAME}/`<br>          },<br>          batchSize: 1<br>        }<br>      }<br>    ]<br>  });<br>}<br><br><br>/**<br> * Generates and retrieves an access token using a service account for authentication.<br> *<br> * @returns {string} The access token required for making authenticated requests.<br> * @throws {Error} If the service account JSON key is missing.<br> */<br>function getAccessToken() {<br>  // Retrieve the JSON key for the service account from script properties<br>  const jsonKey = PropertiesService.getScriptProperties().getProperty(&#39;SERVICE_ACC_KEY&#39;);<br> <br>  // Ensure the JSON key is available before proceeding<br>  if (!jsonKey) {<br>    throw new Error(&#39;Service account JSON key is missing. Please add it in Script Properties.&#39;);<br>  }<br><br><br>  // Parse the JSON key to extract required authentication credentials<br>  const serviceAccount = JSON.parse(jsonKey);<br><br><br>  // Define the JWT payload with essential authentication parameters<br>  const jwt = {<br>    &quot;iss&quot;: serviceAccount.client_email, // Service account email for authentication<br>    &quot;scope&quot;: &quot;https://www.googleapis.com/auth/cloud-platform&quot;, // Scope for accessing cloud services<br>    &quot;aud&quot;: &quot;https://oauth2.googleapis.com/token&quot;, // Audience URL for token exchange<br>    &quot;exp&quot;: Math.floor(Date.now() / 1000) + 3600, // Expiration time (1 hour from now)<br>    &quot;iat&quot;: Math.floor(Date.now() / 1000) // Issued at time<br>  };<br><br><br>  // Define the JWT header specifying the algorithm used for signing<br>  const header = { &quot;alg&quot;: &quot;RS256&quot;, &quot;typ&quot;: &quot;JWT&quot; };<br> <br>  // Encode the header and claim set using base64 encoding<br>  const encodedHeader = Utilities.base64EncodeWebSafe(JSON.stringify(header));<br>  const encodedClaimSet = Utilities.base64EncodeWebSafe(JSON.stringify(jwt));<br><br><br>  // Compute the RSA SHA256 signature using the service account&#39;s private key<br>  const signature = Utilities.computeRsaSha256Signature(`${encodedHeader}.${encodedClaimSet}`, serviceAccount.private_key);<br> <br>  // Encode the signature using base64 encoding for secure transmission<br>  const encodedSignature = Utilities.base64EncodeWebSafe(signature);<br> <br>  // Construct the final JWT token by combining all encoded components<br>  const jwtToken = `${encodedHeader}.${encodedClaimSet}.${encodedSignature}`;<br><br><br>  // Exchange the generated JWT for an access token using Google&#39;s OAuth2 endpoint<br>  const response = UrlFetchApp.fetch(&quot;https://oauth2.googleapis.com/token&quot;, {<br>    method: &quot;post&quot;,<br>    payload: {<br>      &quot;grant_type&quot;: &quot;urn:ietf:params:oauth:grant-type:jwt-bearer&quot;, // Specifies JWT-based authentication<br>      &quot;assertion&quot;: jwtToken // Provides the generated JWT token for authentication<br>    }<br>  });<br><br><br>  // Parse and return the access token from the API response<br>  return JSON.parse(response.getContentText()).access_token;<br>}<br><br><br>/**<br> * Retrieves extracted text from output files stored in a Google Cloud Storage bucket.<br> * The function loops through possible output files and compiles their text contents.<br> *<br> * @param {string} BUCKET_NAME - The name of the bucket containing the file to retrieve.<br> *<br> * @returns {Object} An object containing the extracted text and the processed page numbers.<br> */<br>function getOutputFileAsText(BUCKET_NAME) {<br>  var fullText = &quot;&quot;; // Stores the accumulated extracted text<br>  var pageNumbers = []; // Stores the page numbers processed<br>  var i = 1; // Start from the first file<br><br><br>  while (true) {<br>    fileName = `output-${i}-to-${i}.json`; // Construct file name<br>    const url = `https://storage.googleapis.com/storage/v1/b/${BUCKET_NAME}/o/${encodeURIComponent(fileName)}?alt=media`; // Generate the request URL<br>    let response;<br><br><br>    try {<br>      // Attempt to fetch the JSON output file from the bucket<br>      response = UrlFetchApp.fetch(url, {<br>        method: &#39;GET&#39;,<br>        headers: {<br>          &quot;Authorization&quot;: &quot;Bearer &quot; + ScriptApp.getOAuthToken() // Use OAuth token for authentication<br>        }<br>      });<br>    } catch (error) {<br>      // Log and break the loop when a file is not found<br>      Logger.log(`Output file ${fileName} not found, stopping loop.`);<br>      break;<br>    }<br><br><br>    // Convert the fetched data to a JSON object<br>    const jsonText = response.getBlob().getDataAsString();<br>    const jsonData = JSON.parse(jsonText);<br><br><br>    // Extract page number if available<br>    if (jsonData.responses &amp;&amp; jsonData.responses[0].context) {<br>      pageNumbers.push(jsonData.responses[0].context.pageNumber);<br>    }<br><br><br>    Logger.log(&quot;Pages processed: &quot; + pageNumbers);<br><br><br>    // Extract text content from the annotation, fallback to empty string if missing<br>    let extractedText = jsonData.responses[0]?.fullTextAnnotation?.text || &quot;&quot;;<br><br><br>    // Append extracted text with a space separator if multiple pages exist<br>    fullText = fullText ? fullText + &quot; &quot; + extractedText : extractedText;<br><br><br>    i++; // Increment page number<br>  }<br><br><br>  // Return the extracted text and processed page numbers<br>  return { text: fullText, pageNumbers: pageNumbers };<br>}</pre><p><strong>ExtractTextFromPDF</strong> works by first uploading the PDF to Cloud Storage, and once uploaded, it sends a request to the Vision API for asynchronous text detection, including authorization and necessary request parameters. The function then continuously checks the API’s operation status until the extraction is complete. Once the text extraction is finished, it retrieves the extracted text from the output file(s) stored in the storage bucket using the function <strong>getOutputFileAsText</strong>, cleans up temporary files in the bucket, and returns the processed text. If any errors occur during the process, it logs them and returns null to indicate failure.</p><p>Now, in our Utils.gs file, we’ll add two new functions: one to upload the PDFs being processed to our storage bucket, and another to delete files from the storage bucket once the process is complete.</p><p>The usage of the second function could be optional, but removing temporary files will help us prevent unnecessary storage accumulation. And if you decide not to delete the output files from the storage after each text extraction, it might mess up the retrieval of those files inside the <strong>extractTextFromPDF </strong>function, since that would mean having multiple output files of different PDF files, so you would need to modify the code accordingly.</p><pre>/**<br> * Adds a Blob to a Google Cloud Storage bucket.<br> *<br> * @param {Blob} BLOB - The Blob of the file to add to the bucket.<br> * @param {string} BUCKET_NAME - The name of the bucket to add the file to.<br> * @param {string} OBJECT_NAME - The name/path of the file to add.<br> * @return {Object} objects#resource<br> *<br> * @example<br> * const fileBlob = addFileToCloudStorage(driveBlob, &#39;my-bucket&#39;, &#39;path/to/my/file.txt&#39;);<br> */<br>function addFileToCloudStorage(BLOB, BUCKET_NAME, OBJECT_NAME) {<br>  const bytes = BLOB.getBytes();<br> <br>  // Base URL for Cloud Storage API<br>  const url = `https://www.googleapis.com/upload/storage/v1/b/${BUCKET_NAME}/o?uploadType=media&amp;name=${encodeURIComponent(OBJECT_NAME)}`;<br>  try {<br>    const response = UrlFetchApp.fetch(url, {<br>      method: &#39;POST&#39;,<br>      contentLength: bytes.length,<br>      contentType: BLOB.getContentType(),<br>      payload: bytes,<br>      headers: {<br>        &quot;Authorization&quot;: &quot;Bearer &quot; + ScriptApp.getOAuthToken()<br>      }<br>    });<br>    const uploadedFile = JSON.parse(response.getContentText());<br><br><br>    // Make the file publicly accessible<br>    const aclUrl = `https://www.googleapis.com/storage/v1/b/${BUCKET_NAME}/o/${encodeURIComponent(OBJECT_NAME)}/acl`;<br>    const aclPayload = JSON.stringify({<br>      entity: &quot;allUsers&quot;,<br>      role: &quot;READER&quot;<br>    });<br><br><br>    UrlFetchApp.fetch(aclUrl, {<br>      method: &#39;POST&#39;,<br>      contentType: &quot;application/json&quot;,<br>      payload: aclPayload,<br>      headers: {<br>        &quot;Authorization&quot;: &quot;Bearer &quot; + ScriptApp.getOAuthToken()<br>      }<br>    });<br><br><br>    return uploadedFile;<br>  } catch (error) {<br>    console.error(&#39;(addFileToCloudStorage) Error getting file:&#39;, error);<br>    return null;<br>  }<br>}<br><br><br>/**<br> * Deletes a file from a Google Cloud Storage bucket.<br> *<br> * @param {string} BUCKET_NAME - The name of the bucket containing the file to delete.<br> * @param {string} OBJECT_NAME - The name/path of the file to delete.<br> * @return {boolean} - True if the file was deleted successfully, false if not.<br> *<br> * @example<br> * const fileBlob = addFileToCloudStorage(driveBlob, &#39;my-bucket&#39;, &#39;path/to/my/file.txt&#39;);<br> */<br>function deleteFileFromCloudStorage(BUCKET_NAME, OBJECT_NAME) {<br>  const url = `https://storage.googleapis.com/storage/v1/b/${BUCKET_NAME}/o/${encodeURIComponent(OBJECT_NAME)}`;<br> <br>  // Send DELETE request to GCS<br>  const options = {<br>    &#39;method&#39;: &#39;DELETE&#39;,<br>    &#39;headers&#39;: {<br>      &quot;Authorization&quot;: &quot;Bearer &quot; + ScriptApp.getOAuthToken()<br>    },<br>  };<br><br><br>  const response = UrlFetchApp.fetch(url, options);<br>  const statusCode = response.getResponseCode();<br><br><br>  if (statusCode === 204) {<br>    Logger.log(`File &quot;${OBJECT_NAME}&quot; successfully deleted from bucket &quot;${BUCKET_NAME}&quot;.`);<br>    return true;<br>  } else {<br>    Logger.log(`Failed to delete file. Response: ${response.getContentText()}`);<br>    return false;<br>  }<br>}</pre><p>And lastly, let’s make the following modifications to our Main.gs file to be able to process both images and PDFs:</p><pre>function detectTextWithOCR() {<br>  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();<br>  const data = getTable(sheet, 2, 1);<br><br><br>  for (var i = 0; i &lt; data.length; i++) {<br>    var link = data[i][0];<br>    const fileId = extractFileId(link);<br>    const file = DriveApp.getFileById(fileId);<br>    const fileType = file.getMimeType();<br><br><br>    var extractedText = &quot;&quot;;<br>    if (fileType.includes(&quot;image&quot;)){<br>      Logger.log(&quot;Processing image...&quot;)<br>      extractedText = extractTextFromImage(file.getBlob());<br>    } else {<br>      Logger.log(&quot;Processing PDF...&quot;)<br>      extractedText = extractTextFromPDF(file);<br>    }<br><br><br>    if (extractedText){<br>      Logger.log(&quot;Text extracted successfully&quot;);<br>      sheet.getRange(&quot;B&quot;+ (i+2)).setValue(extractedText);<br>    } else {<br>      Logger.log(&quot;Error extracting text, check file&quot;);<br>      continue;<br>    };<br>  }  <br>}</pre><p>And done! To try it this part of the code remember to update your spreadsheet with more Google Drive links, but this time PDF files. Again, you can simply click on the “Run” button inside of our project or use the code snippet I showed you previously to have a menu tab in your spreadsheet that allows you to run it anytime.</p><h3>Common troubleshooting tips</h3><ul><li>Error 403: “Insufficient Permission”</li></ul><p>I was getting the following error repeatedly when first using the function addFileToCloudStorage:</p><pre>Error getting file: { [Exception: Request failed for https://www.googleapis.com returned code 403. Truncated server response: {<br>  &quot;error&quot;: {<br>    &quot;code&quot;: 403,<br>    &quot;message&quot;: &quot;Insufficient Permission&quot;, …</pre><p>The solution was to add the missing OAuth Scopes inside the appsscript.json file. I even forgot to do this step while writing this tutorial, oops!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/0*41Syiwt130dppAU9" /></figure><ul><li>Not giving your service account the appropriate permissions will lead to authorization errors. Don’t forget to assign to it both “Cloud Vision AI Service Agent” and “Storage Object Viewer” roles.</li><li>Make sure your Cloud Storage bucket uses <strong>fine-grained </strong>access control rather than uniform. When I first attempted to add a file to the bucket, the default configuration was set to uniform access, which was causing me issues.</li></ul><h3>Conclusion</h3><p>Implementing OCR capabilities with the Cloud Vision API in Google Apps Script opens up a wide array of possibilities for automating document processing and data extraction workflows. By leveraging the seamless integration between Google services and the API, users are able to develop tailored solutions that significantly reduce manual effort and improve accuracy. Whether for extracting text from PDFs stored in Google Drive or processing images in a collaborative environment like Google Sheets, this approach provides a flexible and scalable way to incorporate advanced OCR functionalities into everyday tools.</p><p>Looking forward, the approach outlined in this tutorial encourages further experimentation and customization. As OCR technology continues to evolve, integrating it into cloud-based workflows offers immense potential for enhancing productivity and data insights. Whether you’re working on personal automation or building professional solutions, understanding how to use OCR tools can be a valuable addition to your toolkit. Happy coding and exploring the power of AI-driven text recognition! 🤓.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OMenM4nKsvYMoh9W.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><h3>References</h3><p>Commons, M. (2010). LibGuides: Introduction to OCR and searchable PDFs: Adobe Acrobat Pro. <a href="https://guides.library.illinois.edu/c.php?g=347520&amp;p=4116755">https://guides.library.illinois.edu/c.php?g=347520&amp;p=4116755</a></p><p>John, R. (2025). A comprehensive guide to OCR APIs (+10 best tools in 2025). Docsumo.com. <a href="https://www.docsumo.com/blogs/ocr/api">https://www.docsumo.com/blogs/ocr/api</a></p><p>Russell, J. (2021). Library guides: Optical Character Recognition (OCR): An introduction: Home. <a href="https://guides.libraries.psu.edu/OCR">https://guides.libraries.psu.edu/OCR</a></p><p>Ukil, R. (2023). 3 steps to measuring effectiveness of OCR and cash application automation. HighRadius Resource Center; HighRadius. <a href="https://www.highradius.com/resources/Blog/3-steps-to-measuring-effectiveness-of-ocr-and-cash-application-automation/">https://www.highradius.com/resources/Blog/3-steps-to-measuring-effectiveness-of-ocr-and-cash-application-automation/</a></p><p>What is optical character recognition (OCR)? (2025). Ibm.com. <a href="https://www.ibm.com/think/topics/optical-character-recognition">https://www.ibm.com/think/topics/optical-character-recognition</a></p><h4>Google Cloud Documentation</h4><ul><li><a href="https://cloud.google.com/docs">https://cloud.google.com/docs</a></li><li><a href="https://developers.google.com/apps-script/guides/cloud-platform-projects">https://developers.google.com/apps-script/guides/cloud-platform-projects</a></li><li><a href="https://cloud.google.com/vision/docs/ocr">https://cloud.google.com/vision/docs/ocr</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40a349329450" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/how-to-implement-ocr-tools-with-cloud-vision-api-in-google-apps-script-40a349329450">How to Implement OCR Tools with Cloud Vision API in Google Apps Script</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring Trends with Survey Analytics and Data Mining]]></title>
            <link>https://medium.com/accel-ai/exploring-trends-with-survey-analytics-and-data-mining-44e1370dbb2f?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/44e1370dbb2f</guid>
            <category><![CDATA[survey-analysis]]></category>
            <category><![CDATA[data-mining]]></category>
            <category><![CDATA[surveys]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-analysis]]></category>
            <dc:creator><![CDATA[María Guerra]]></dc:creator>
            <pubDate>Wed, 26 Feb 2025 16:02:16 GMT</pubDate>
            <atom:updated>2025-02-26T16:02:15.479Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZTSVR80peuCjkIEcvhbK9g.png" /></figure><p>Did you know that more than 80% of the data generated worldwide in recent years is considered unstructured or underutilized? (Mina, 2020). In this sea of information, data mining emerges as an essential tool for analyzing large volumes of data and extracting valuable insights. This process involves identifying patterns, relationships, and trends in data, providing a solid foundation for informed decision-making.</p><p>Surveys, specifically, are a key source of structured data as they allow for the direct collection of information from individuals, capturing their opinions, preferences, and behaviors. With the rise of tools such as Google Forms, SurveyMonkey, and Typeform, the creation and management of surveys have become significantly simplified. However, collecting data is not enough, advanced analysis techniques are necessary to transform that data into meaningful information.</p><p>Applying data mining to surveys offers significant benefits, such as the possibility of discovering new insights, identifying hidden patterns, and predicting future trends based on collected data. These capabilities not only enrich the analysis but also enable organizations to anticipate and proactively respond to changes and needs (Tan, Steinbach, Karpatne, and Kumar, 2019).</p><p>This article will explore the growing importance of data mining in survey analysis, address how to prepare the collected data for analysis, discuss the main challenges associated with its application, share practical examples of its use in real life, and much more.</p><h4>Characteristics of Survey Data</h4><p>Survey data can be broadly categorized into three types:</p><ol><li><strong>Quantitative Data:</strong> Numerical data that can be measured and statistically analyzed, such as income levels, age, or satisfaction ratings. This data is easily structured and suitable for data mining techniques like classification, regression, and association analysis.</li><li><strong>Qualitative Data:</strong> Non-numeric data capturing perceptions, opinions, and experiences through open-ended questions. These are primarily used in natural language processing (NLP) techniques.</li><li><strong>Mixed Data:</strong> A combination of quantitative and qualitative responses, offering a more comprehensive perspective.</li></ol><h4>Challenges in Survey Data</h4><p>Despite its usefulness, survey data presents certain challenges:</p><ul><li><strong>Data Quality:</strong> Ensuring accuracy and reliability in responses can be difficult due to factors such as respondent inattention or survey design errors.</li><li><strong>Missing Values:</strong> The absence of complete responses may bias the analysis and reduce the validity of conclusions. This requires techniques like data imputation or case deletion depending on the context.</li><li><strong>Bias:</strong> Surveys are often affected by biases, whether cognitive (such as social desirability or dishonesty in responses) or technical (like leading questions). These biases compromise objectivity and complicate the correct interpretation of results.</li><li><strong>Sample Representativeness:</strong> If the sample is not representative of the target population, the survey results may not be generalizable.</li></ul><h4>Data Collection Methods and Their Impact</h4><p>The wording, structure, and format of questions significantly influence survey data quality. Clear, concise, and unbiased questions are essential for reliable and useful responses. The design should consider factors such as logical question ordering, inclusion of appropriate response options, and avoidance of ambiguous terms or technical jargon. Poorly designed surveys can lead to confusion, demotivation to complete the survey, and unreliable data collection, directly affecting the validity of conclusions.</p><p>Technological advancements have transformed survey methods, allowing comparisons between traditional and digital methods. Digital surveys facilitated by platforms like Google Forms and Typeform offer advantages such as ease of distribution, real-time analysis, and cost efficiency, in addition to multimedia elements and branching logic. However, traditional paper-based surveys remain relevant in areas with limited internet access or where a personal touch is essential.</p><p>Sampling is vital to ensure that results accurately reflect the target population. This involves selecting a subset of individuals from a larger population to participate in a survey. Techniques such as random sampling and stratified sampling are indispensable tools in this process. Without representative sampling, results may lack reliability and generalizability, compromising data-driven decisions.</p><h4>Visualization of Survey Results</h4><p>Data visualization is an essential step in survey analysis as it transforms numbers and responses into graphic representations that facilitate interpretation and decision-making. Good visualization not only organizes the data but also tells a story, highlighting patterns, trends, and relationships in a way understandable for technical and non-technical audiences alike.</p><p>To effectively represent survey results, there are several advanced data visualization tools, each with unique features that make them ideal depending on the context:</p><p><strong>1. Tableau:</strong> Provides an intuitive interface and drag-and-drop capabilities to create interactive dashboards, ideal for analyzing large data volumes and sharing dynamic results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/0*oxfp_ihXBUMldOXD" /></figure><p><strong>2. Power BI:</strong> Integrated with the Microsoft ecosystem, Power BI allows the generation of automated visual reports, with direct integration to multiple data sources, making it a robust option for corporate presentations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1vWLLdBqxdCPI_PA" /></figure><p><strong>3. Python Libraries (Matplotlib and Seaborn):</strong> For those with programming knowledge, these libraries offer flexibility and complete control over visualizations. Matplotlib is excellent for basic charts, while Seaborn simplifies the creation of advanced statistical graphs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*M5YzTrtZMrKywgT9" /></figure><h4>Effective Visualization Examples</h4><p>Choosing the correct type of visualization is crucial for communicating findings clearly and accurately. Common examples include:</p><ul><li><strong>Bar Charts:</strong> Ideal for showing frequency distributions or comparing categories, such as the percentage of responses for different options.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/0*V83SsPQJI-bIengf" /></figure><ul><li><strong>Heatmaps:</strong> Useful for representing correlations between variables, highlighting positive, negative, or neutral relationships.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/0*5G3HCG36z-7lGL3C" /></figure><ul><li><strong>Pie Charts:</strong> Suitable for illustrating proportions within a dataset, though they should be used sparingly to avoid confusion.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*5YnQ5gLvKhA_RR4I" /></figure><ul><li><strong>Scatter Plots:</strong> Excellent for analyzing relationships between two variables and detecting trends.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/0*2c3No7KZUdaZ6mEr" /></figure><h4>Interpreting Results for Non-Technical Audiences</h4><p>When presenting data, it is important to make it accessible and meaningful for everyone, regardless of their technical background. To achieve this, you can simplify the language by avoiding technical or complex terms and using clear and direct descriptions. Key points should be highlighted by emphasizing the most important conclusions through the use of colors, annotations, or standout graphics to maintain the audience’s attention. It is also recommended to use visual storytelling, presenting the data in a narrative format that guides the audience through the findings. Finally, iterating and testing before presenting ensures that the graphics are understandable to individuals outside the analysis process. By applying these strategies, survey results can be transformed into actionable insights that drive data-based decisions, fostering collaboration and alignment among various stakeholders.</p><h3>Survey Data Preparation for Data Mining</h3><p>Data preparation is a critical step in the data mining process, as it ensures that the data obtained from surveys is in optimal condition for analysis. This process helps reduce errors and make data mining models more effective since improperly prepared data can lead to biased results or misinterpretations, compromising decisions based on these analyses. Data preparation involves essential activities such as data cleaning, preprocessing, and transformation, which we will explain below.</p><h4>Data Cleaning and Preprocessing</h4><p>Data cleaning and preprocessing are the first steps to ensure the quality and reliability of survey data. This process may include:</p><p><strong>1. Handling Missing Values: </strong>Missing values are common in surveys and can occur due to respondent omissions or technical errors. Strategies to address this problem include:</p><ul><li><strong>Data Imputation:</strong> Filling in missing values using techniques such as the column average, the most frequent value, or advanced algorithms like K-Nearest Neighbors (KNN).</li><li><strong>Record Removal:</strong> In some cases, removing records with many missing values may be an option, though care must be taken not to overly reduce the sample size.</li></ul><p><strong>2. Outlier Detection and Correction: </strong>Extreme or outlier values can distort analyses. Statistical techniques such as using percentiles or visual methods like box plots can help identify them. Depending on the context, outliers can be removed or adjusted.</p><p><strong>3. Consistency and Formatting: </strong>Ensuring that data is in a uniform format is crucial. For example, dates should follow the same format, and categorical variables should be standardized (such as “Yes/No” instead of combinations like “YES,” “yes,” or “Y”).</p><p><strong>4. Duplicate Removal: </strong>In digital surveys, respondents may submit multiple answers. Identifying and removing duplicate records ensures that each entry is unique.</p><h4><strong>Data Transformation</strong></h4><p>Once the data is clean, it must be transformed to be compatible with data mining algorithms. The following activities can be used: (In the examples below, Python was used as the primary programming language.)</p><p><strong>Categorical Variable Encoding<br></strong>Categorical variables must be converted into a numeric format for models to process. Common methods include:</p><ul><li><strong>One-Hot Encoding:</strong> Creating binary columns for each category, assigning 1 if the category is present and 0 if not.</li></ul><pre>import pandas as pd<br><br>data = {&#39;Category&#39;: [&#39;Red&#39;, &#39;Blue&#39;, &#39;Green&#39;]}<br>df = pd.DataFrame(data)<br><br># One-Hot Encoding<br>df_one_hot = pd.get_dummies(df, columns=[&#39;Category&#39;])<br>print(df_one_hot)</pre><p>Console output:</p><pre>   Category_Blue  Category_Red  Category_Green  <br>0              0             1               0  <br>1              1             0               0  <br>2              0             0               1</pre><ul><li><strong>Ordinal Encoding:</strong> Assigning numeric values based on an inherent order, such as “Low = 1,” “Medium = 2,” “High = 3.”</li></ul><pre>from sklearn.preprocessing import OrdinalEncoder<br><br>data = {&#39;Level&#39;: [&#39;Low&#39;, &#39;Medium&#39;, &#39;High&#39;]}<br>df = pd.DataFrame(data)<br><br># Ordinal Encoding<br>order = OrdinalEncoder(categories=[[&#39;Low&#39;, &#39;Medium&#39;, &#39;High&#39;]])<br>df[&#39;Ordinal_Level&#39;] = order.fit_transform(df[[&#39;Level&#39;]])<br>print(df)</pre><p>Console output:</p><pre>    Level  Ordinal_Level  <br>0    Low            0.0  <br>1  Medium            1.0  <br>2   High             2.0</pre><p><strong>Normalization and Scaling of Data</strong><br>Numerical variables with different ranges can skew the results of some algorithms. Normalization (scaling values between 0 and 1) or standardization (subtracting the mean and dividing by the standard deviation) are common techniques to standardize data.</p><ul><li>Normalization (Min-Max Scaling):</li></ul><pre>from sklearn.preprocessing import MinMaxScaler<br><br>data = [[500], [1000], [1500]]<br>scaler = MinMaxScaler()<br>normalized_data = scaler.fit_transform(data)<br>print(normalized_data)</pre><p>Console output:</p><pre>[[0. ]  <br> [0.5]  <br> [1. ]]</pre><ul><li>Standardization (Z-Score Scaling):</li></ul><pre>from sklearn.preprocessing import StandardScaler<br><br>data = [[500], [1000], [1500]]<br>scaler = StandardScaler()<br>standardized_data = scaler.fit_transform(data)<br>print(standardized_data)</pre><p>Console output:</p><pre>[[-1.22474487]  <br> [ 0.        ]  <br> [ 1.22474487]]</pre><p><strong>Derived Variable Generation<br></strong>In some cases, it is useful to create new variables based on combinations or transformations of existing ones. For example, calculating the average satisfaction from several related questions or transforming absolute values into percentages.</p><pre>import pandas as pd<br><br>data = {&#39;Question1&#39;: [4, 5, 3], &#39;Question2&#39;: [3, 4, 4]}<br>df = pd.DataFrame(data)<br><br># Create a new variable as the average satisfaction<br>df[&#39;Average_Satisfaction&#39;] = df.mean(axis=1)<br>print(df)</pre><p>Console output:</p><pre>   Question1  Question2  Average_Satisfaction  <br>0          4          3                   3.5  <br>1          5          4                   4.5  <br>2          3          4                   3.5</pre><p><strong>Dimensionality Reduction<br></strong>In surveys with many questions, analysis can become complicated due to high dimensionality. Techniques such as Principal Component Analysis (PCA) can reduce the number of variables while retaining most of the relevant information.</p><pre>from sklearn.decomposition import PCA<br>from sklearn.datasets import load_iris<br><br># Load data<br>data = load_iris()<br>X = data.data<br><br># Reduce to 2 dimensions<br>pca = PCA(n_components=2)<br>X_reduced = pca.fit_transform(X)<br>print(X_reduced[:5])  # Show only the first 5 rows</pre><p>Console output:</p><pre>[[-2.68412563  0.31939725]  <br> [-2.71414169 -0.17700123]  <br> [-2.88899057 -0.14494943]  <br> [-2.74534286 -0.31829898]  <br> [-2.72871654  0.32675451]]</pre><p><strong>Text Transformations<br></strong>If the data includes open-ended responses, they must be processed before analysis. This can involve tokenization, removing irrelevant words (stopwords), and converting text into numeric representations such as TF-IDF or embeddings.</p><ul><li><strong>Tokenization and Stopword Removal:</strong></li></ul><pre>from nltk.tokenize import word_tokenize<br>from nltk.corpus import stopwords<br><br>text = &quot;This is a simple example of text processing.&quot;<br>tokens = word_tokenize(text.lower())<br>stop_words = set(stopwords.words(&#39;english&#39;))<br><br># Remove stopwords<br>filtered_tokens = [word for word in tokens if word not in stop_words]<br>print(filtered_tokens)</pre><p>Console output (assuming NLTK stopwords are installed):</p><pre>[&#39;simple&#39;, &#39;example&#39;, &#39;text&#39;, &#39;processing&#39;, &#39;.&#39;]</pre><ul><li><strong>TF-IDF Representation:</strong></li></ul><pre>from sklearn.feature_extraction.text import TfidfVectorizer<br><br>texts = [&quot;Example text&quot;, &quot;Another text example&quot;]<br>vectorizer = TfidfVectorizer()<br>tfidf_matrix = vectorizer.fit_transform(texts)<br><br>print(tfidf_matrix.toarray())</pre><p>Console output:</p><pre>[[0.70710678 0.70710678 0.        ]  <br> [0.        0.70710678 0.70710678]]</pre><h3><strong>Techniques of Data Mining and its Application in Surveys</strong></h3><p>Data mining offers a set of techniques to analyze and extract useful patterns from data, including surveys. These techniques allow for the identification of trends, relationships, and behaviors from the collected responses.</p><p>The choice of the appropriate technique depends on the type of survey, the analysis objectives, and the nature of the data collected (qualitative, quantitative, or mixed). Utilizing data mining allows extracting value from survey data and transforming responses into actionable insights for decision-making. Below are some of the most commonly used data mining techniques and their application in survey analysis.</p><h4><strong>Classification</strong></h4><p>Classification is defined as the process of finding a model (or function) that describes and distinguishes data classes or concepts (Han et al., 2012, p. 18). It is based on building a model from a set of training data, which is then used to predict the class of new objects.</p><p>The types of survey data to be used with this technique are quantitative and structured categorical data, such as satisfaction ratings or “yes/no” responses.</p><p><strong>Applications in surveys:</strong></p><ul><li><strong>Segmenting respondents:</strong> For example, classifying participants into groups like “satisfied customers” and “unsatisfied customers” based on their responses.</li><li><strong>Behavior prediction:</strong> Using past responses to predict whether a customer is likely to leave a service or purchase a product.</li></ul><p><strong>Common algorithms:</strong></p><ul><li>Decision trees</li><li>Support Vector Machines (SVM)</li><li>Neural networks</li></ul><p><strong>Practical example:</strong> In a customer satisfaction survey, classification models can be used to identify key factors that distinguish satisfied customers from unsatisfied ones.</p><h4><strong>Clustering</strong></h4><p>According to Molina and García (2006), clustering “allows the identification of typologies or groups where the elements have great similarity to each other and many differences with those of other groups.” (p. 98). Therefore, this technique is used to discover hidden structures and segment data into homogeneous groups.</p><p>The types of survey data to be used with this technique are mixed data, combining quantitative variables (such as income) and qualitative variables (such as preferences).</p><p><strong>Applications in surveys:</strong></p><ul><li><strong>Profile identification: </strong>Grouping respondents into segments based on similar patterns, such as product preferences or consumption habits.</li><li><strong>Hidden pattern detection: </strong>Discovering emerging trends in responses, such as new demands or common concerns.</li></ul><p><strong>Common algorithms:</strong></p><ul><li>K-Means</li><li>DBSCAN (Density-Based Spatial Clustering)</li><li>Hierarchical models</li></ul><p><strong>Practical example:</strong> In a public health survey, clustering could reveal subgroups of people with similar healthcare needs, helping to personalize intervention strategies.</p><h4><strong>Association Analysis</strong></h4><p>Molina and García (2006) state that “This type of technique is used to establish possible relationships or correlations between different actions or seemingly independent events; recognizing how the occurrence of one event or action can induce or generate the appearance of others” (p. 107). In other words, it is especially useful for identifying frequent combinations or unexpected associations between responses.</p><p>The types of survey data to be used with this technique are categorical and mixed data, such as selected options in multiple-choice surveys.</p><p><strong>Applications in surveys:</strong></p><ul><li><strong>Identifying frequent patterns</strong>: For example, discovering that people who value service quality also tend to consider prices as a key factor.</li><li><strong>Designing personalized strategies: </strong>Making decisions based on associations, such as cross-promoting products for specific groups.</li></ul><p><strong>Common algorithms:</strong></p><ul><li>Apriori Algorithm</li><li>FP-Growth</li></ul><p><strong>Practical example:</strong> In a purchase preference survey, it might be found that those who buy product A also tend to buy product B, facilitating the creation of combined offers.</p><h4><strong>Regression</strong></h4><p>Regression is used to model relationships between a dependent variable (outcome) and one or more independent variables (predictive factors). However, this technique is mainly applied to quantitative data, which limits its use in surveys with predominantly qualitative questions.</p><p>The types of survey data to be used with this technique are continuous quantitative or ordinal categorical data, such as satisfaction levels or income.</p><p><strong>Applications in surveys:</strong></p><ul><li><strong>Impact analysis: </strong>Determining how factors such as price, quality, or service influence customer satisfaction.</li><li><strong>Trend prediction: </strong>Analyzing how current responses can predict future behaviors, such as the likelihood of contract renewal.</li></ul><p><strong>Common algorithms:</strong></p><ul><li>Linear regression</li><li>Logistic regression (for categorical variables)</li></ul><p><strong>Practical example:</strong> In an energy consumption survey, regression could analyze how factors such as the size of the household and the number of inhabitants affect the monthly electricity consumption.</p><h4><strong>Common Errors in Survey Analysis</strong></h4><p>Analyzing survey data can be complex and is subject to several common errors. One of the most frequent is overfitting models. This occurs when a model fits the training data too closely, capturing noise instead of meaningful patterns. As a result, the model may perform excellently on training data but fail to generalize to new data. To avoid this, it is crucial to use cross-validation techniques and maintain a separate test data set.</p><p>Another common error is misinterpreting correlations. It is easy to assume that a correlation between two variables implies causality, but this is not always true. It is important to use appropriate statistical methods to determine causality and not base decisions on fake correlations.</p><p>Finally, underestimating biases in the data can lead to erroneous conclusions. Survey data can be biased due to the way it is collected, the questions asked, or the sample selected. It is essential to identify and correct these biases to obtain accurate and representative results.</p><h4><strong>Ethical Considerations</strong></h4><p>Analyzing survey data through data mining raises several important ethical considerations. Firstly, the privacy of respondents is crucial. Personal data must be handled carefully to avoid any leakage or misuse, so it is essential to anonymize the data and ensure it is only used for its intended purposes.</p><p>Bias is another critical aspect. Data mining techniques can perpetuate or even amplify existing biases in the data. For example, if survey data reflects social prejudices, models can learn and replicate these biases, leading to unfair decisions. It is fundamental to implement techniques to detect and mitigate these biases, ensuring that models are fair and equitable.</p><p>Equity in data analysis involves ensuring that results and decisions based on this data do not discriminate against any group. This requires continuous evaluation and adjustments to the models to ensure that all respondents are treated fairly.</p><h4><strong>Regulatory and Legal Considerations</strong></h4><p>The use of survey data is subject to various regulations and laws that vary by jurisdiction. It is essential to comply with regulations such as the General Data Protection Regulation (GDPR) in Europe, which sets strict guidelines on how personal data should be collected, stored, and processed. Organizations must ensure they obtain explicit consent from respondents and provide them with clear information on how their data will be used.</p><p>Additionally, it is important to be aware of local and sectoral laws that may apply and ensure that all data handling practices comply with these legal requirements to avoid sanctions and protect the organization’s reputation.</p><h4><strong>Conclusion</strong></h4><p>We have highlighted the growing relevance of data mining in survey analysis, emphasizing its ability to transform large volumes of data into valuable information for decision-making. Through techniques such as classification, clustering, and regression, patterns can be identified, significant relationships discovered, and future trends predicted. Important challenges have also been identified, such as ensuring data quality, mitigating biases, and respecting ethical and legal considerations.</p><p>Looking ahead, trends in survey analysis are expected to focus on integrating advanced technologies such as artificial intelligence, which will enable deeper and automated data analysis, or the use of predictive analytics, allowing organizations not only to understand the present but also to anticipate future behaviors and trends.</p><p>Real-time data visualization tools and mobile-optimized survey platforms will also be positioned as key trends. These innovations facilitate decision-making by providing instant information and significantly improving the user experience, increasing participation and the quality of the data collected.</p><p>In terms of advancements, the growing concern for privacy and data protection is expected to drive the development of more robust methodologies that ensure compliance with regulations such as GDPR. This will strengthen respondent trust while also fostering significant improvements in text analysis and natural language processing, facilitating the extraction of deeper and more valuable insights from open-ended responses.</p><p>These technologies will not only enrich the understanding of individuals’ opinions and behaviors but also transform survey analysis into a more dynamic and strategic process. And you, how do you think data mining will transform the future of surveys in your industry?</p><h4>References</h4><p>Beernaert, B. (2021). <em>Using Machine Learning Techniques For Analyzing Survey Data. </em><a href="https://lib.ugent.be/catalog/rug01:003008293">https://lib.ugent.be/catalog/rug01:003008293</a></p><p>Han, J., Kamber, M. &amp; Pei, J. (2012). <em>Data mining: concepts and techniques.</em> Morgan Kaufmann.</p><p>Mina A. (2020) <em>Big data and artificial intelligence in future patient management. How is it all started? Where are we at now? Quo tendimus?</em> <a href="http://doi.org/10.1515/almed-2020-0014">doi.org/10.1515/almed-2020–0014</a></p><p>Molina López, J. M. &amp; García Jesús, J. (2006). <em>Técnicas de minería de datos basadas en aprendizaje automático: Aplicaciones prácticas utilizando Microsoft Excel y Weka.</em> Técnicas de análisis de datos.</p><p>Tan, P. N., Steinbach, M., Karpatne, A. &amp; Kumar, V. (2019). <em>Introduction to data mining. </em>Pearson Education.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*47wAf_rjIQIT1XUl.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44e1370dbb2f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/exploring-trends-with-survey-analytics-and-data-mining-44e1370dbb2f">Exploring Trends with Survey Analytics and Data Mining</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decolonizing AI: Lessons from Paola Ricaurte’s Powerful CSCW 2024 Keynote]]></title>
            <link>https://medium.com/accel-ai/decolonizing-ai-lessons-from-paola-ricaurtes-powerful-cscw-2024-keynote-160be25da2f1?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/160be25da2f1</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[decolonization]]></category>
            <category><![CDATA[ai-ethics]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Jennafer Shae Roberts]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 17:42:03 GMT</pubDate>
            <atom:updated>2025-02-24T17:42:03.269Z</atom:updated>
            <content:encoded><![CDATA[<h3>Decolonizing AI: Lessons from Paola Ricaurte’s Powerful CSCW Keynote</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hhs4Q4LzZgQvbqAID_XJtg.png" /></figure><p>While artificial intelligence (AI) is often heralded as the pinnacle of human innovation, its colonial underpinnings and ecological consequences demand urgent scrutiny. At the heart of the Computer-Supported Cooperative Work &amp; Social Computing (CSCW) 2024 conference, the keynote address on ‘Building Feminist and Decolonial AI in Latin America: Experiences from the ground’ offered a powerful call to rethink how AI is conceptualized, developed, and deployed. Delivered by <a href="https://programs.sigchi.org/cscw/2024/authors/181293">Paola Ricaurte who is associated with Tecnológico de Monterrey, and the Berkman Klein Center for Internet &amp; Society</a>, this thought-provoking session brought together insights from Indigenous knowledge systems, environmental justice movements, and critical AI studies to challenge the dominant paradigms driving the field today. Paola Ricaurte’s keynote delivered a clarion call to reimagine AI as a tool for collective liberation, grounded in Indigenous knowledge and environmental justice. What could we imagine for a post-colonial world alongside AI?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rr2ZOc72uMiCy6Fd" /></figure><h4>Acknowledging the Colonial Roots of AI</h4><p>The keynote began by situating AI within the broader context of colonialism and extractivism. <a href="https://programs.sigchi.org/cscw/2024/authors/181293">Paola Ricaurte</a> highlighted how the development of AI systems is often predicated on the exploitation of both human and natural resources:</p><ul><li><strong>Data as Extraction</strong>: The collection of vast datasets from individuals, often without their consent, mirrors colonial practices of resource extraction.</li><li><strong>Environmental Costs</strong>: The energy-intensive processes required for training AI systems disproportionately impact communities already vulnerable to climate change, reinforcing global inequities.</li></ul><p>By tracing these connections, the speaker emphasized the importance of situating AI within the histories of exploitation that continue to shape our world.</p><h4>Centering Indigenous Knowledge Systems</h4><p>One of the keynote’s most compelling arguments was the value of Indigenous knowledge systems in reshaping AI. Unlike Western approaches that often prioritize efficiency and scale, Indigenous worldviews emphasize interdependence, reciprocity, and sustainability. Paola Ricaurte offered examples of how these principles could inform AI development:</p><ul><li>Designing AI systems that prioritize community well-being over corporate profit.</li><li>Embracing relationality by involving affected communities in decision-making processes.</li><li>Fostering sustainability by considering the long-term ecological and social impacts of AI technologies.</li></ul><h4>Resisting Technological Determinism</h4><p>A recurring theme in the keynote was the need to resist technological determinism. Technological determinism is the belief that technological progress is an unstoppable force that inherently improves society — a view that the keynote critiqued for its oversimplification and erasure of harms. <a href="https://programs.sigchi.org/cscw/2024/authors/181293">Paola Ricaurte</a> critiqued this narrative, arguing that it obscures the harms caused by AI systems and limits our imagination of what technology could be.</p><p>The speaker called for a shift from “solutionism” to “relational design,” emphasizing that AI should not be treated as a panacea for societal problems. Instead, AI must be embedded in broader movements for social and environmental justice, addressing root causes rather than symptoms. This stood out to me, as I do not assume that AI is a neutral tool, and I understand that we need to think beyond efficiency and towards justice. Anytime I come across the topic of relationality, I think that it makes so much sense, and shows how nonsensical things are that do not recognize the relational nature of how things work. In the context of AI and colonialism, <strong>relationality emphasizes the interconnectedness, reciprocity, and sustainability</strong> that are often central to Indigenous knowledge systems.</p><p>Relationality involves recognizing the relationships between humans, technology, and the environment, and it calls for AI development to prioritize community well-being and consider the long-term ecological and social impacts of AI technologies. We need to shift our thinking to considering <strong>technologies of resistance</strong>: Developing and supporting technologies that empower individuals and communities to resist the undesired use of AI in their lives and local contexts.</p><h4>Practical Pathways Toward Decolonizing AI</h4><p>The keynote concluded with actionable steps for decolonizing AI, offering a roadmap for scholars, practitioners, and policymakers. Firstly, there needs to be prioritization on the <strong>redistribution of power</strong>. Control over AI development must be shifted from corporations to communities, ensuring that those most impacted by AI systems have a voice in shaping them. Second, <strong>data sovereignty</strong> must be promoted. The rights of individuals and communities must be upheld in order to control how their data is collected, stored, and used. Third, <strong>pluriversal approaches</strong> must be adopted. We must move beyond one-size-fits-all solutions by embracing diverse ways of knowing and being. And finally, <strong>environmental harm</strong> must be mitigated. We must prioritize the development of energy-efficient AI systems and advocate for the responsible sourcing of materials used in AI infrastructure.</p><h4>A Call to Action</h4><p><a href="https://programs.sigchi.org/cscw/2024/authors/181293">Paola Ricaurte</a>’s address was more than an academic critique; it was a rallying cry for transformative change. By decolonizing AI, we can move toward a future where technology serves the collective good rather than perpetuating harm. This requires courage, creativity, and a willingness to imagine alternatives to the status quo.</p><p>As the keynote concluded, the audience was left with a profound challenge: How can we, as a global community, reimagine AI in ways that honor human dignity and planetary health? How does this radiate outwards beyond the effects of AI and new technologies to society more broadly? The answers to this question will shape not only the future of AI but also the future of our interconnected world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tdXEO-bgbLXRoBB3.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=160be25da2f1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/decolonizing-ai-lessons-from-paola-ricaurtes-powerful-cscw-2024-keynote-160be25da2f1">Decolonizing AI: Lessons from Paola Ricaurte’s Powerful CSCW 2024 Keynote</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Pipeline: Rethinking Human Labor in AI at CSCW 2024]]></title>
            <link>https://medium.com/accel-ai/beyond-the-pipeline-rethinking-human-labor-in-ai-at-cscw-2024-7f9178289167?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/7f9178289167</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[workers-rights]]></category>
            <category><![CDATA[ai-bias]]></category>
            <category><![CDATA[ai-ethics]]></category>
            <dc:creator><![CDATA[Jennafer Shae Roberts]]></dc:creator>
            <pubDate>Thu, 09 Jan 2025 19:07:36 GMT</pubDate>
            <atom:updated>2025-01-09T19:07:36.840Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J8FE6FQOGfzlE79jMntP4Q.png" /></figure><p>Who does the work behind AI? While AI systems are celebrated for their automation, they rely on extensive — and often invisible — human labor. This labor is rarely acknowledged in the dominant narratives surrounding AI. At the CSCW 2024 workshop, <em>The Work of AI: Mapping Human Labor in the AI Pipeline</em>, scholars, practitioners, and activists gathered to critically examine the often-invisible human labor behind AI systems and to challenge the dominant narratives surrounding AI development and its impacts. I was very happy to be able to join and share research I did with Nana Nwachukwu and Laura Montoya for a short paper we coauthored, <a href="https://openreview.net/forum?id=GHebpJCtTj">The Glamorization of Unpaid Labor: AI and its Influencers.</a> Our paper explored how the glamorization of unpaid labor obscures the real human effort behind AI development, drawing attention to the role of influencers and online communities in perpetuating this dynamic.</p><p>All of the participants had written a short paper for the workshop, and one of my favorites was called ‘Seamful Design for Labor Visibility in AI Pipelines: Insights from Transit Advocacy and Smart Cities’ by Taneea S Agrawaal and Robert Soden at the University of Toronto, on the seamfulness of AI. The authors spoke of seamfulness as the opposite of seamlessness, as AI is often portrayed as running seamlessly, however that is not the case. It actually runs with a lot of seams, and those seams often represent the exploitative and precarious labor that makes AI seem to be seamless, when it is not. Seamfulness highlights the often-overlooked flaws and gaps in AI systems, shedding light on the hidden human labor that keeps them running smoothly. Pluriversal approaches emphasize the importance of diverse, context-specific solutions for AI governance, rejecting the notion that a single model can work universally.</p><h4>Rethinking the AI Pipeline Metaphor</h4><p>One of the workshop’s central discussions revolved around the limitations of the “AI pipeline” metaphor. While the term is widely used to describe the linear progression of data collection, model training, deployment, and evaluation, participants challenged its simplicity. They argued that this metaphor fails to capture the dynamic, interconnected, and messy reality of AI development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wWXPZIpSQp17FMzO" /><figcaption>The workshop began with a participatory exercise of mapping out labor on the AI pipeline on the floor</figcaption></figure><p>Instead, alternative metaphors such as ecosystems, networks, or “living libraries” were proposed. These models emphasize the continuous and interdependent nature of AI work, acknowledging the contributions of human labor, the influence of socio-political contexts, and the need for adaptive oversight.</p><h4>Recognizing Bias and the Need for Accountability</h4><p>The workshop underscored the intrinsic biases within AI systems. Participants highlighted that bias cannot simply be “removed” from AI systems; instead, it must be continuously monitored and mitigated. Bias reflects the political, economic, and social contexts in which AI operates. Addressing it requires not only technical fixes but also governance frameworks that ensure accountability and transparency.</p><p>A key takeaway was the importance of acknowledging the partial and situated nature of AI systems. This means openly communicating the limitations and assumptions baked into AI models and fostering iterative processes to refine them as contexts evolve.</p><h4>Highlighting the Invisible Labor in AI</h4><p>The workshop brought attention to the undervalued and often invisible human labor required to support AI systems. Consider the data annotators who label thousands of images daily, or the moderators exposed to harmful content to train algorithms, often under the guise of making AI ‘ethical.’ Their contributions remain essential yet invisible, not to mention exploitative. These workers are critical to AI’s functionality but are frequently marginalized in discussions about AI’s impact.</p><p>Participants discussed ways to better acknowledge and support this labor, such as:</p><ul><li>Ensuring fair wages and working conditions for workers involved in tasks like data labeling and content moderation.</li><li>Creating mechanisms for workers to voice concerns and influence the design of AI systems.</li><li>Promoting transparency around the role of human labor in sustaining AI technologies.</li></ul><h4>Imagining New Models of AI Governance</h4><p>The workshop concluded with a call for alternative models of AI governance that prioritize equity, sustainability, and community participation. Suggestions included:</p><ul><li>Decentralized oversight systems inspired by public libraries or Wikipedia, which rely on transparency and community-driven moderation.</li><li>Advocacy for “pluriversal” approaches to AI that resist one-size-fits-all solutions and center local needs and values.</li></ul><p>Participants also emphasized the need to address AI’s broader environmental and ethical implications. This includes examining the extractive practices that sustain AI development, from the exploitation of natural resources to the energy-intensive processes of training large language models.</p><h4>Final Thoughts</h4><p>The CSCW 2024 workshop brought together researchers to explore the intricate and often-overlooked human labor embedded in AI systems. These discussions highlighted how questions of bias, accountability, and labor visibility are deeply intertwined, shaping how AI systems are developed and governed. This workshop underscored a critical truth: AI systems are not autonomous entities but the products of extensive human effort and socio-political contexts. By embracing new metaphors and governance models, we can chart a path toward AI systems that uplift, rather than exploit, humanity. We can envision governance models that prioritize justice, sustainability, and collective well-being. Such an approach is essential for advancing AI systems, catching and correcting them when they replicate existing inequities, and applying appropriate checks and balances at every turn.</p><p>Join the conversation: How do you think we can make AI labor more visible and equitable? Share your thoughts or connect with us to continue this critical dialogue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XkjyTyWwBqeOMc9_.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f9178289167" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/beyond-the-pipeline-rethinking-human-labor-in-ai-at-cscw-2024-7f9178289167">Beyond the Pipeline: Rethinking Human Labor in AI at CSCW 2024</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Computer Vision]]></title>
            <link>https://medium.com/accel-ai/introduction-to-computer-vision-25c003a9ff2e?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/25c003a9ff2e</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Anthony Barrios]]></dc:creator>
            <pubDate>Fri, 20 Dec 2024 16:17:07 GMT</pubDate>
            <atom:updated>2024-12-20T16:17:07.445Z</atom:updated>
            <content:encoded><![CDATA[<p>In a world where images and videos are part of our daily communication process, Computer Vision has emerged as one of the indispensable technologies, quickly developing in the Artificial intelligence field. This discipline teaches machines to “see” the world and has transformed how we interact with smart devices and how these devices interpret and respond to our environment.</p><p>This article will explore the world of Computer Vision, discussing its definition, how it works, and its applications in various industries. We will also look at recent advancements in the field and potential benefits and challenges. Whether you are a technology enthusiast or just curious about how computers “see” the world, this article will provide an insightful overview of this fascinating technology.</p><h3>What is Computer Vision?</h3><p>Computer Vision is a subfield of Artificial Intelligence and Machine Learning, where different techniques allow the machine to understand digital images and videos. It implies analyzing those images to extract the necessary information to solve a problem. This approach is similar to how humans use our eyes to recognize faces, objects, and scenes.</p><p>Computer vision involves many disciplines and techniques, including statistics and mathematics. Statistics helps with pattern recognition, noise reduction, and the training of models; for example, Gaussian filters are based on probability distribution. On the other hand, mathematics fields like linear algebra, calculus, and geometry support image transformation and optimization. With these disciplines, machines can learn to classify images, detect objects, track motion, and even recognize human emotions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4Wlqng9eScsO2MX2" /><figcaption><em>Image extracted from </em><a href="https://www.rishabhsoft.com/blog/computer-vision"><em>What is Computer Vision and its Benefits — Rishabh Software</em></a></figcaption></figure><h3>Computer Vision Vs. Image Processing</h3><p>Some people confuse computer vision with image processing because these are widely related fields, but they have differences in their objectives and applications. While image processing works in preparing images for further analysis or improving their quality for human perception, the goal is not to interpret the content or understand the objects that may appear.</p><p>Image processing manipulates images through algorithms and can perform tasks like image enhancement, such as bright and contrast adjustment, filter and noise elimination, and conversion between different image formats.</p><p>On the other hand, Computer Vision, as we stated before, searches for data extraction to understand the visual environment. Some of the tasks that can be performed by computer vision include object detection, recognition, tracking, and segmentation. These applications are applied in various fields, including self-driving cars, medical imaging, surveillance, and robotics.</p><h3>Requirement and Key Concepts for Computer Vision</h3><p>Venturing into computer vision requires comprehensive resources and skills to effectively develop and implement vision-based applications. There are some hardware and software you must have.</p><p>In the hardware section, you will need cameras and sensors of various types since the core of Computer Vision is the need for capturing images or videos. From standard digital cameras to more specialized ones like thermal or depth cameras, or LiDar Systems (which can be used to enhance depth perceptions and mapping capabilities by giving distance measurements, ideal for applications in robotics and 3D mapping).</p><p>Furthermore, the computationally intensive nature of computer vision tasks demands powerful processing units. Graphics Processing Units (GPUs) often have the heaviest task in computer vision since deep learning models and complex image processing tasks leverage their parallel processing capabilities. Recommendations go from the 8GB minimum to 16GB recommended VRAM. While processors (CPUs) handle various tasks, having a powerful CPU with multiple cores helps in pre-processing and running other essential computer vision algorithms. A minimum of 4 cores is recommended, with more cores offering better performance.</p><p>On the software side, it involves libraries and frameworks that will enable us to work with images, train models, and build applications. Some popular choices are the Open Source Computer Vision Library (OpenCV), TensorFlow, and PyTorch.</p><p>OpenCV is a widely used open–source library offering a comprehensive set of functions for real-time computer vision tasks like image processing, feature extraction, and object detection. According to its website, it has more than 2500 optimized algorithms, including a comprehensive set of both classic and more updated computer vision and machine learning algorithms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*IGeo1eIBUYkaTFjm" /><figcaption>Image extracted from <a href="https://learning.rc.virginia.edu/courses/opencv/">Scientific Image Processing with Python OpenCV | RC Learning Portal</a></figcaption></figure><p>Tensorflow and PyTorch are popular deep-learning frameworks that allow you to build, train, and deploy computer vision models. Both offer high-level APIs and extensive functionalities for various deep-learning tasks.</p><p>Apart from these technical requirements, a solid foundation in mathematics and statistics, including areas like linear algebra, calculus, and probability is essential for understanding these algorithms. But don’t worry if these aren’t your strongest suit yet, there are plenty of resources available to help you build your mathematical and statistical confidence!</p><p>Remember, even a basic grasp of these mathematical concepts will go a long way in understanding the intuition behind the algorithms, and you can always delve deeper as you progress. The important thing is to jump in and be curious.</p><h3>Fundamental Processes of Computer Vision</h3><p>Computer vision systems form a pipeline through which visual information is converted into meaningful interpretations or decisions. These processes can be broadly categorized into several key stages:</p><ol><li>Image Acquisition: this is the first step where the visual data is captured through cameras and/or sensors. The quality of image acquisition directly impacts the effectiveness of subsequent processing steps. Image acquisition can involve considerations like lighting, angles, and resolution.</li><li>Image pre-processing: once captured, the image data might need some cleaning and preparation, this can include tasks such as:</li></ol><ul><li>Noise Reduction, which consists in removing irrelevant information or distortions.</li><li>Contrast enhancement, made by adjusting the image to make certain features more distinguishable.</li><li>Normalization, where images are scaled to a standard size or intensity range.</li><li>Edge detection, which highlights the edges of objects within an image to simplify analysis.</li></ul><p>3. Feature extraction: in this step, the system identifies and extracts key features from the image, which is crucial for reducing the resources required to process large volumes of data. This will result in identifying details such as edges, corners, or specific shapes; these will be used to represent the image in subsequent processes.</p><p>4. Segmentation: the goal is to partition an image into meaningful segments that can represent individual objects, distinct regions with specific properties, or even groups of pixels that share similar characteristics, and can be easier to analyze. Segmentation techniques can be based on attributes like color, intensity, or texture. Some examples might be:</p><ul><li>Thresholding, a simple method where pixels are classified based on their intensity values. For example, in biological research, specifically in the study of cells, we can use thresholding by separating the foreground (cells with high intensity) from the background (low intensity).</li><li>Region-based segmentation, consists in grouping pixels with similar characteristics into regions. Unlike thresholding, it considers multiple properties of pixels to achieve more sophisticated and accurate segmentation.</li></ul><p>5. Object Detection and Recognition: in simpler terms, object detection is like finding and labeling objects in a picture, while recognition is just figuring out what the objects are. To do this, computers can use patterns, features, or powerful learning models like CNNs to pinpoint and categorize all sorts of objects in an image or video.</p><p>6. Classification: imagine teaching a computer to sort things. Classification is like creating an expert for identifying objects, showing it a bunch of pictures with labels, like “dog” or “table”. By studying these examples, the expert can use this knowledge to figure out what new things are in other pictures, allowing it to predict the correct label for objects it hasn’t seen before.</p><p>7. Tracking: when analyzing videos, tracking keeps tabs on things that move. It does this by finding the object in each frame, one after another. This is useful for things like security systems where we want to see where people or objects are going.</p><p>8. Post-processing: the final step is like polishing a gem — we take the results from the earlier steps and make them even more accurate. This can involve getting rid of any false alarms (where the computer thought it saw something that wasn’t there), combining all the information we found, and making sense of it all. Finally, we use this refined data to make the best decisions possible.</p><p>There are many tools and tricks computers use to do each of these steps, and new ideas from machine learning and deep learning keep making them better and faster. By putting all these steps together, computers can “see” and understand pictures and videos more and more accurately, which lets them be used in all sorts of cool ways across many different fields.</p><h3>Practical Applications</h3><p>Computer vision has a wide array of applications across various industries, significantly transforming how tasks are performed and services are delivered. Here are some key applications of computer vision:</p><ol><li>Healthcare</li></ol><ul><li>Medical Imaging Analysis: computer vision algorithms are transforming medical imaging analysis. By analyzing X-rays, MRI scans, and CT scans, these algorithms can detect subtle abnormalities that might be missed by the human eye.</li><li>Patient Monitoring: vision systems can be used to continuously monitor patients in intensive care units or at home. They can track vital signs, analyze facial expressions for signs of pain, and even detect changes in gait or posture that might indicate emerging medical issues.</li></ul><p>2. Automotive and Transportation</p><ul><li>Traffic Management: computer vision systems can be installed at intersections and along roadways, continuously analyzing traffic patterns. They can detect congestion in real-time, allowing authorities to dynamically adjust traffic signals to optimize flow, or even make an automatic algorithm that permits traffic lights to change.</li></ul><p>3. Sports and Entertainment</p><ul><li>Performance Analysis: by analyzing footage of athletes’ movements and plays, computer vision systems can provide detailed feedback on technique and strategy. This can help athletes identify areas for improvement, such as optimizing swing mechanics in baseball.</li></ul><h3>Challenges and Limitations</h3><p>Computer vision has made remarkable strides in recent years, but it still faces significant challenges and limitations. These issues can affect the performance and applicability of vision systems across various domains. Here are some of the main challenges and limitations:</p><ol><li>Variability in Lighting and Weather Conditions</li></ol><p>Computer vision systems often struggle in environments with variable lighting, such as shadows, glare, or insufficient light, which can significantly degrade the quality of image analysis.</p><p>Adverse weather conditions like fog, rain, or snow can obscure visual sensors, making it difficult for systems to accurately interpret visual data.</p><p>2. Complexity of Real-World Environments</p><p>Real-world scenarios are incredibly diverse and unpredictable. Objects can be partially obscured, perspectives can vary, and scenes can be cluttered, all of which pose challenges for accurate object detection and recognition.</p><p>Background noise and similar-looking objects can lead to misclassifications or false positives/negatives.</p><ol><li>High Computational Requirements</li></ol><p>Many computer vision tasks, especially those involving deep learning, require substantial computational power and memory. This can limit the deployment of advanced computer vision systems to environments where high-end hardware is feasible.</p><p>Real-time processing needs, such as in autonomous vehicles or real-time surveillance, impose even greater demands on system capabilities.</p><p>2. Data Bias and Ethical Concerns</p><p>Training datasets may not be representative of all demographics, leading to biases in model predictions. For example, facial recognition systems have been found to have higher error rates for certain racial groups.</p><p>The use of computer vision in surveillance and personal data analysis raises significant privacy and ethical concerns, requiring careful regulation and transparent practices.</p><p>3. Integration with Other Systems</p><p>Computer vision often needs to be integrated with other systems and technologies, such as IoT devices or robotics. This integration can be complex, involving synchronization of different technologies and data types.</p><p>Ensuring robust and secure communication between systems can be challenging, especially in critical applications like healthcare or transportation.</p><p>4. Scalability</p><p>Scaling computer vision systems from controlled experimental settings or small-scale deployments to widespread real-world applications can introduce unexpected challenges. These include handling significantly larger datasets, diverse operating conditions, and ensuring consistent performance across different platforms.</p><p>5. Algorithmic Limitations</p><p>Despite advances, certain tasks remain difficult for computer vision systems, such as understanding context from a single image, dealing with abstract or non-literal images, and long-term scene understanding.</p><p>Algorithms can be sensitive to small changes in input data or parameters, leading to unstable performance in new or slightly different environments.</p><p>6. Standardization and Quality Control</p><p>There is a lack of standardization in terms of how vision data is processed, stored, and shared, which can hamper the development and evaluation of systems.</p><p>Ensuring the quality and reliability of computer vision applications is critical, particularly in safety-critical areas like autonomous driving and medical diagnostics.</p><h3>Tutorial</h3><p>For this tutorial, we will make an image segmentation algorithm using Jupyter Notebooks with the Conda Distribution.</p><p>Image segmentation is the process of partitioning an image into multiple segments or clusters. The goal is to simplify the representation of an image to make it more meaningful and easier to analyze. This technique is commonly used to locate objects and boundaries in images.</p><p>We will also be using the OpenCV library. In that case, we need to run the following line code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nck1ddHG2402FE1B" /></figure><p>Once installed, we will need to import the libraries to the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/0*vzpfrWLPDUy9kOFM" /></figure><p>Cv2 is the OpenCV library for computer vision tasks. The Numpy library, which we have used before in my previous tutorials, is for numerical operations. Matplotlib.pyplot is a library for plotting images. Finally, urllib.request is a library for downloading images from a URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kxe__cOU7v9h7-75" /></figure><p>This code downloads an image from a URL and loads it into a format that can be processed by OpenCV.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/0*tyxHBkxLFrWawRxb" /></figure><p>Once the image is loaded in the code, we will convert the image to RGB for better compatibility with the Matplotlib library. Then the image is reshaped into a 2D array where each row represents a pixel, and each column represents the color channels (R, G, B). This makes it easier to apply the k-means clustering algorithm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/0*HY-9MRDCKzY1Wc_5" /></figure><p>Now we will initialize the criteria for the K-Means algorithm, it defines the conditions under which the algorithm will stop iterating. Specifically, it terminates after completing 100 iterations or achieving an accuracy threshold of 0.2, whichever comes first. This ensures that the algorithm does not run indefinitely and provides control over the convergence quality.</p><p>The k parameter specifies the number of clusters into which the image is to be divided, influencing how detailed the segmentation will be. Finally, cv2.kmeans is the function from OpenCV that implements the k-means algorithm. It processes the image data, partitions it into the specified number of clusters, and returns two key outputs: the centers of these clusters, which represent the average color of pixels in each cluster, and the labels for each pixel, indicating which cluster a particular pixel belongs to.</p><p>This method effectively groups pixels with similar characteristics and is widely used in image processing to simplify and reduce the complexity of images for analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/0*75qYITSqvoUeab8P" /></figure><p>This is a crucial part of the image segmentation process using k-means clustering.</p><p>The first code block converts the cluster centers to 8-bit integers. The cluster centers calculated by the k-means algorithm are typically in floating-point format, representing the mean color values of the pixels in each cluster. This process is necessary because the pixel intensity values in images are usually represented as integers ranging from 0 to 255, and ensures that the cluster centers can be directly used as color values for virtualizing the image.</p><p>The second code block works on the labeling mapping and the image reshaping. After the conversion, each pixel in the original image is labeled with a cluster index by the k-means algorithm. These labels indicate which cluster (or color center) each pixel belongs to. This line maps each pixel’s label to the corresponding cluster center value.</p><p><em>‘labels.flatten()’ </em>converts the label array into a 1D array, and <em>‘centers[…]’ </em>uses this array to look up and replace each label with its corresponding cluster center color. The result is a 1D array where each pixel’s color is now one of the cluster centers.</p><p>Since the mapping process flattens the image into a 1D array of colors, it needs to be reshaped back to the original dimension of the image to restore its original structure. <em>‘image.shape’ </em>provinces the dimensions (height, width, and color channels) needed to reshape the array back into a proper image format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/0*PBy_UcWktFTpDb6p" /></figure><p>Now we use this to display both the original and the segmented images side by side for visual comparison, using the <em>matplotlib </em>library, showing as the result the following plot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*bhizESxHN9epqjYR" /></figure><p>This is the main tutorial, but we may come to think: How can I use this image for an analysis?</p><p>Using the segmented image obtained from the algorithm, you can perform various analyses to extract meaningful information, for this example, we’ll use a color analysis.</p><p>The color analysis of the segmented image focuses on the simplified representation provided by the k-means clustering, which groups similar colors into clusters. This contrasts with the analysis of the original image, where the color information is more detailed and varied.</p><p>In the following code, we will show how closely the colors of the segments in the processed image match the average colors of the corresponding regions in the original image. This can be particularly useful in applications where color fidelity and segmentation accuracy are critical, such as in digital arts or medical imaging.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J-YONjk6qqL1OOl9" /></figure><p>As result</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/0*-Fly_iKuuE1g4Qly" /></figure><p>Cluster 1: Original Mean Color: [ 92.90724 142.18944 165.9082 ], Segmented Mean Color: [ 92 142 165]</p><p>Cluster 2: Original Mean Color: [ 42.713947 84.39792 110.38863 ], Segmented Mean Color: [ 42 84 110]</p><p>Cluster 3: Original Mean Color: [160.1698 177.44855 189.85788], Segmented Mean Color: [160 177 189]</p><p>Remember you can always find the source code on our <a href="https://github.com/AccelAI/AI-Tutorials/tree/main/IntroComputerVision_Tutorial">Github Page!</a></p><h3>In Conclusion,</h3><p>This article offers a thorough exploration of Computer Vision, skillfully introducing its core concepts, functionalities, and applications across various industries. It distinguishes Computer Vision from similar technologies such as image processing, detailing the essential hardware and software required for its implementation, including tools like OpenCV, TensorFlow, and Pytorch.</p><p>We went across the practical applications of Computer Vision, highlighting its transformative impact on sectors such as healthcare, automotive, and entertainment, and acknowledged the challenges and limitations of the technology, including lightning issues, weather conditions, and computational demands.</p><p>A practical tutorial on image segmentations using k-means clustering makes an enriched ending for this article, providing you, my dear readers, with a hands-on demonstration of applying Computer Vision techniques.</p><p>I’m happy to announce that I’m working on a project using Computer Vision in education, more specifically for kindergarten children. I hope once I have finished and presented this work, share with you, in a very quick way, all the processes that took the project. Thanks for reading!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jLFgfe_W3OywVR-L.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><h3>References:</h3><ul><li><a href="https://www.ibm.com/topics/computer-vision">What is Computer Vision? | IBM</a></li><li><a href="https://fullscale.io/blog/computer-vision-concepts/">Computer Vision Concepts</a></li><li><a href="https://randomwalk.ai/blog/the-5-fundamental-processes-in-computer-vision/">The 5 Fundamental Processes in Computer Vision</a></li><li><a href="https://www.v7labs.com/blog/what-is-computer-vision">What Is Computer Vision? [Basic Tasks &amp; Techniques]</a></li><li><a href="https://opencv.org/blog/research-areas-in-computer-vision/#:~:text=Challenges%20and%20Limitations,%2C%20making%20them%20resource%2Dintensive.">Research Areas in Computer Vision: Trends and Challenges</a></li><li><a href="https://www.javatpoint.com/computer-vision-applications">Computer Vision Applications — javaTpoint</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25c003a9ff2e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/introduction-to-computer-vision-25c003a9ff2e">Introduction to Computer Vision</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI for Forestry: Protecting Our Forests with Cutting-Edge Technology]]></title>
            <link>https://medium.com/accel-ai/ai-for-forestry-protecting-our-forests-with-cutting-edge-technology-a051359883fc?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/a051359883fc</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[climate-change]]></category>
            <category><![CDATA[ai-for-good]]></category>
            <category><![CDATA[forestry]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Jennafer Shae Roberts]]></dc:creator>
            <pubDate>Thu, 05 Dec 2024 02:02:26 GMT</pubDate>
            <atom:updated>2024-12-05T02:02:26.306Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZqyM9HCO5KpVzY5UeKy6pA.png" /></figure><blockquote>This is part two of a series of blog posts based on a course I completed with Climate Change in AI, <a href="https://www.climatechange.ai/events/summer_school2024">Climate Change AI Summer School</a>. Check out the first blog on <a href="https://medium.com/accel-ai/climate-change-and-agriculture-can-ai-help-83c5a03efa29">AI and agriculture,</a> and keep your eyes peeled for more articles on how AI can be used to monitor and mitigate the harms of climate change in other areas.\</blockquote><p>Forests are the lungs of our planet, and are essential for clean air, water purification, and sustaining biodiversity. Our world faces an escalating crisis: between 2015 and 2020, over <a href="https://www.fao.org/state-of-forests/en/#:~:text=Between%202015%20and%202020%2C%20the,80%20million%20hectares%20since%201990.">10 million hectares of forest were lost annually</a>, a rate that continues to accelerate due to deforestation and climate change. This destruction fuels a vicious cycle, intensifying global warming, threatening countless species with extinction, and destabilizing ecosystems that millions of people depend on for survival. The time to act is now — delaying conservation efforts will push us closer to an irreversible tipping point.</p><p>One key challenge in forest conservation is monitoring deforestation and illegal logging activities. Traditional methods like remote sensing are often time-consuming and expensive. AI-powered tools can analyze satellite imagery and sensor data to detect changes in forest cover in real-time, enabling authorities to identify and respond to deforestation incidents more swiftly.</p><p>For example, <a href="https://www.researchgate.net/publication/385680061_AI-based_Validation_of_Deforestation_Using_High-Resolution_Satellite_Imagery_in_the_Brazilian_Amazon">Brazil</a> has leveraged AI through its Amazon monitoring system, which uses satellite imagery and machine learning algorithms to track illegal logging and deforestation activities. This technology has significantly enhanced the government’s ability to enforce environmental laws and protect one of the world’s most critical ecosystems. Similarly, in <a href="https://www.canada.ca/en/natural-resources-canada/news/2022/10/tree-planting-drones-to-revitalize-reforestation-efforts-in-areas-affected-by-wildfires.html">Canada</a>, drones equipped with AI capabilities are being employed in post-logging recovery efforts to monitor reforestation progress and assess the health of new growth. These case studies demonstrate the tangible benefits of AI in revolutionizing forestry management and restoration efforts.</p><p>By analyzing data on forest composition and growth patterns, AI has the potential to help ensure the preservation of critical ecosystems and promote reforestation efforts. AI can empower citizen science by providing tools that allow anyone to collect and submit environmental data, contributing to a more comprehensive understanding of forest health. This fosters community involvement and works to develop equitable technology which serves nature and supports global conservation. However, the data needs to be reliable, and privacy concerns need to be addressed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/0*7W2smU-zN4MqLGAz" /><figcaption>Image credit:<strong> </strong><a href="https://gainforest.earth/">Gainforest.Earth</a></figcaption></figure><p><strong>AI for Monitoring Payment for Ecosystem Services (PES) with GainForest.Earth</strong></p><p><a href="https://gainforest.earth/">Gainforest.Earth</a> is a decentralized science non-profit creating the world’s first community-driven data commons dedicated to preserving biodiversity. Founder Dr. David Dao understands the importance of protecting forests on a global scale. Dr. Dao recognized the need for ground-level support, in the form of direct payment to landowners for not deforesting. This is where AI comes in: to track that these payments are effectively protecting forested areas by analyzing satellite images over time. AI helps to prove that this payment system works surprisingly well at preventing deforestation.</p><p>Programs like those championed by organizations such as <a href="https://gainforest.earth/">GainForest.Earth</a> are called ‘payment for ecosystem services’ (PES) programs. These programs incentivize landowners to protect forests through providing financial incentives. To ensure that payments are distributed equitably and that deforestation rates decline, robust monitoring systems are essential.</p><p>GainForest.Earth leverages AI and machine learning in a unique way. They combine satellite imagery analysis with data collected directly from local communities. This decentralized approach empowers local communities to participate in monitoring efforts and ensures that the benefits of PES programs reach those who are protecting forests on the ground.</p><p>Because AI can be used to analyze satellite imagery to track changes in forest cover over time, we can identify areas where deforestation is occurring. By comparing areas with active PES programs to control groups, AI algorithms can assess the program’s impact on deforestation rates. Additionally, AI can help identify potential hotspots of deforestation and allocate resources accordingly.</p><p>This data-driven approach, combined with the decentralized data collection efforts supported by GainForest.Earth, allows for more transparent and accountable PES programs. It ensures that payments are distributed fairly, that forests are protected, and that the desired conservation outcomes are achieved.</p><p><strong>Drones in the Forest</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CnPTimM1lGs0FQBx" /><figcaption>Image Credit: <a href="https://www.zenadrone.com/drone-reforestation-and-global-warming/">https://www.zenadrone.com/drone-reforestation-and-global-warming/</a></figcaption></figure><p>Using <a href="https://www.youtube.com/watch?v=4BHONrKyd1Q">drones to collect data</a> on forest health and structure is another way of utilizing decentralized data collection methods that provide valuable insights into individual trees, helping us identify healthy trees, damaged trees, and deadwood, among other helpful insights.</p><p><strong>Key Information for Effective Forest Management</strong></p><p>To optimize forest management, AI algorithms need specific human-annotated information, including:</p><ul><li><strong>Tree structure:</strong> Segmentation of individual trees, distinguishing between wood/leaf and stem/crown components.</li><li><strong>Species identification:</strong> Accurate classification of tree species.</li><li><strong>Wood quality:</strong> Assessment of timber properties.</li><li><strong>Tree growth:</strong> Monitoring tree development and health.</li></ul><h3>The Importance of Quality Data</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/0*PsYaFN5fjbWPHx2e" /><figcaption>Image Credit: <a href="https://gainforest.earth/">https://gainforest.earth/</a></figcaption></figure><p>Accurate and comprehensive data is the backbone of effective AI algorithms, especially in complex fields like forestry. The reliance on data in AI systems cannot be overstated; without high-quality inputs, the outputs will be unreliable. The use of drone imagery to assess environmental impacts post-harvesting is one prominent example. Drones equipped with high-resolution cameras and multispectral sensors can capture detailed images of forest areas, allowing for precise evaluations of tree health, biomass, and soil conditions.</p><p>For instance, a study published in the journal <a href="https://www.mdpi.com/journal/remotesensing"><em>Remote Sensing</em></a> highlighted how drone imagery was utilized to monitor forest recovery after logging in British Columbia, Canada. The findings demonstrated that drone-collected data could effectively evaluate compliance with reforestation regulations, revealing areas where regeneration was inadequate and identifying potential ecological impacts. This kind of monitoring is essential for ensuring that forest operations adhere to environmental regulations and minimize damage to ecosystems.</p><p>For example, the below image from a study with Remote Sensing shows maps of the Sundarban region and nearby delta in West Bengal, highlighting differences in ground elevation and tree species. The data reveals that the eastern Sundarban has higher ground, 1–2 meters above surrounding islands, due to ongoing sediment buildup, while the surrounding islands have been deprived of sediment for decades. The higher elevation in the eastern Sundarban is also influenced by taller tree canopies. The map labels areas dominated by specific tree species and shows zones where two species overlap. Arrows point out errors in the elevation data from satellite measurements, which are different from natural height changes across water channels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/0*J3XyK2qzpCvzYGyh" /><figcaption>Image credit: <a href="https://www.mdpi.com/2072-4292/16/15/2796">https://www.mdpi.com/2072-4292/16/15/2796</a></figcaption></figure><p><strong>Privacy Challenges of AI Usage</strong></p><p>It must be said that complex challenges persist in data collection. Ethical data practices are essential, particularly in regions with vulnerable communities that depend on forests for their livelihood. The use of AI tools, such as drones and satellite imagery, can inadvertently infringe on their privacy, capturing sensitive information about their activities, settlements, or cultural sites without consent. This raises significant ethical concerns about data ownership and the potential misuse of information. To address these issues, it is essential to prioritize transparency, involve communities in decision-making processes, and implement strict data governance policies that respect their rights. Protecting their privacy while ensuring accurate and ethical data collection fosters trust, safeguards cultural integrity, and ensures that conservation efforts are truly inclusive and equitable.</p><p>Additionally, varying lighting conditions, such as shadows cast by trees or changes in sunlight, can significantly affect the quality of drone imagery, leading to inaccurate assessments. For instance, research highlights that inconsistent lighting conditions, such as shadows or variations in sunlight, can lead to the misclassification of vegetation types, posing challenges for biodiversity management. A relevant study assessing the impact of lighting conditions on vegetation classification highlights how illumination inconsistencies can significantly affect the accuracy of remote sensing data. <a href="https://plantmethods.biomedcentral.com/articles/10.1186/s13007-023-01028-8">Research</a> using UAV (drone) imagery has shown that strong lighting variations, such as direct sunlight or heavy cloud cover, can distort vegetation indices and tree height measurements. These errors arise because different lighting conditions impact how vegetation reflects light, which is critical for accurate classification and monitoring. This underscores the importance of developing robust data collection methods, including the use of multiple imaging techniques and standardized protocols to ensure consistent results across various conditions. Integrating data from various sources, including satellite imagery and ground-based sensors, can help create a more comprehensive view of forest health and operations.</p><h3>Digitally Enabled Forest Operations</h3><p>By equipping machinery with GPS and advanced computing capabilities, the forestry industry can enhance operational efficiency, sustainability, and compliance. For example, smart forestry machines equipped with IoT sensors can track their movements in real-time, creating detailed maps of harvested areas and monitoring ongoing activities.</p><p>A practical application of this technology is found in the work of companies like <a href="https://forestry.trimble.com/#:~:text=CONNECTED%20FOREST%C2%AE,-by%20Trimble%20Forestry&amp;text=Trimble%20Forestry%20offers%20the%20world&#39;s,business%2C%20all%20in%20real%20time.&amp;text=decision%2Dmaking%20in%20every%20step,land%20acquisition%20through%20to%20delivery.">Trimble</a>, which offers precision forestry solutions. Their systems enable operators to gather data on tree inventory, soil quality, and harvesting activities. This data is then analyzed using AI algorithms to optimize routes and minimize fuel consumption, ultimately reducing the carbon footprint of logging operations. In addition, these systems help ensure compliance with operational guidelines, preventing unauthorized logging and illegal land use.</p><p>The use of AI-driven analytics can significantly improve decision-making processes. For instance, a forestry management system deployed in <a href="https://www.metsateollisuus.fi/en/home">Finland</a> utilized AI to analyze sensor data from harvesting equipment and predict potential operational disruptions due to weather conditions. By proactively managing these risks, companies could optimize their workflows and enhance productivity.</p><p>Digital technologies also facilitate better stakeholder communication. Real-time data sharing with regulatory bodies can streamline compliance checks, making it easier to demonstrate adherence to environmental standards. This transparency not only helps maintain ecological balance but also builds trust with local communities and stakeholders, who are increasingly concerned about the sustainability of forest operations.</p><p>The combination of quality data and digital technologies is transforming forestry into a more sustainable, efficient, and transparent industry. By leveraging AI, we have the opportunity to better monitor forest health, optimize operations, and ensure compliance with environmental regulations, utilizing tools for responsible forest management in the future.</p><p><strong>The Power of 3D Data</strong></p><p>Three-dimensional (3D) data, collected using terrestrial scanners, mobile scanners, drones, or helicopters, offers a detailed understanding of forest structure. While the cost of 3D data collection has decreased significantly, manual annotation of datasets remains a bottleneck. High-density point clouds, capturing trees, branches, and rocks, require careful labeling to train accurate AI models.</p><p>AI has the potential to revolutionize our approach to forest conservation. By analyzing vast amounts of multi-modal environmental data, including satellite and drone imagery, sound recordings, and sensor data, AI can help us understand the health, location, and ecological value of forests at unprecedented scale. This information can then be used to inform policy decisions, financial investments, and on-the-ground conservation efforts.</p><p><strong>Challenges and Risks in AI for Forestry</strong></p><p>While AI offers tremendous potential for sustainable forest management, several challenges must be addressed:</p><ul><li><strong>Data quality:</strong> Small tree size, uneven data sparsity, and ground structure complexity can hinder algorithm performance.</li><li><strong>Processing speed:</strong> Handling large point clouds requires efficient computing resources and parallel processing techniques.</li><li><strong>Transferability:</strong> AI models may struggle to adapt to diverse forest conditions, limiting their applicability. (e.g. it doesn’t transfer to mangrove forests well yet)</li><li><strong>Hardware integration:</strong> Deploying AI models on embedded devices for real-time operations in forests can be technically challenging.</li><li><strong>Reliance on human annotators: </strong>Hours and hours of human work needs to go into labeling datasets of forests, which needs to be accurate in order for the data to be useful. The ethics of this labor need to be considered.</li></ul><p>It is essential to acknowledge the challenges and potential pitfalls. A primary concern is the reliance on accurate and sufficient data. Data gaps, biases, and inaccuracies can significantly impact the reliability of AI models in general. Additionally, ensuring data privacy and security is crucial, especially when dealing with sensitive information related to forest ownership and land rights, or any imagery that could inadvertently contain people.</p><p>Another challenge lies in the interpretability of AI models. Understanding how these complex algorithms arrive at their conclusions is essential for building trust and accountability. Black-box models can hinder effective decision-making and hinder the adoption of AI technologies.</p><p>The potential for unintended consequences cannot be overlooked. Over-reliance on AI could lead to a decline in human expertise and understanding of forest ecosystems. It is essential to maintain a balance between technology and human knowledge.</p><p>Lastly, the implementation of AI solutions requires significant financial investment and technical expertise, as well as cultural and social shifts in behavior. Ensuring equitable access to these technologies is crucial to avoid exacerbating existing inequalities.</p><h3>Future Outlook: The Role of AI in the Future of Forestry</h3><p>The future of AI in forestry holds immense promise as it becomes increasingly integrated with other emerging technologies. Combining AI with the Internet of Things (IoT) can enhance real-time monitoring of forest health through networks of connected sensors, providing granular data on factors like soil moisture, tree growth, and carbon sequestration. Additionally, <a href="https://www.sciencedirect.com/science/article/pii/S0168169923008840">blockchain</a> technology offers the potential to revolutionize transparency in logging practices by creating secure, immutable records of timber harvesting and trade, ensuring accountability and reducing illegal deforestation.</p><p>Advancements in AI itself — such as improved machine learning models and predictive analytics — could further aid conservation by accurately forecasting deforestation risks, optimizing reforestation strategies, and even modeling the long-term impacts of different forest management scenarios under changing climate conditions.</p><p>Collaboration is essential to unlocking these possibilities. Partnerships between technologists, policymakers, researchers, and local communities can ensure AI applications are ethical, inclusive, and tailored to specific ecological and cultural contexts. Initiatives like the Climate Change AI summer school exemplify the potential for cross-disciplinary learning, as professionals from diverse fields work together to apply AI for climate action and restoration projects.</p><p>AI is just one tool in the fight against deforestation and environmental degradation, but its potential to drive sustainable forestry practices and safeguard ecosystems is unparalleled. By combining cutting-edge technology with effective policies and the wisdom of local communities, we can take significant steps toward ensuring a healthier, more resilient planet for generations to come.</p><h3>Call-to-Action: Get Involved in the Fight for a Sustainable Future</h3><p>The potential of AI to combat deforestation and drive sustainable forestry practices is vast, but it requires collective effort to realize its full impact. If you’re inspired to contribute, there are several ways you can take action today:</p><ul><li><strong>Join the Climate Change AI community</strong>: Connect with like-minded individuals passionate about leveraging AI for environmental conservation. Share ideas, collaborate on projects, and learn from experts working at the intersection of technology and sustainability.</li><li><strong>Explore job opportunities</strong>: Visit<a href="https://www.climatechange.ai/"> Climate Change AI</a> to find roles in AI and climate-related fields and contribute your skills to groundbreaking initiatives.</li><li><strong>Stay informed</strong>: Follow the Climate Change AI blog and newsletter to keep up with the latest advancements, success stories, and events in the field.</li></ul><p>Whether you’re a researcher, technologist, policy advocate, or concerned citizen, there’s a place for you in this growing movement. Together, we can harness the power of AI to protect our forests and ensure a sustainable future for generations to come.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzmVO_Pm8yYRJcdie_kzrQ.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a051359883fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/ai-for-forestry-protecting-our-forests-with-cutting-edge-technology-a051359883fc">AI for Forestry: Protecting Our Forests with Cutting-Edge Technology</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Model Selection and Hyperparameter Tuning with GridSearchCV]]></title>
            <link>https://medium.com/accel-ai/automating-model-selection-and-hyperparameter-tuning-with-gridsearchcv-f7c4bc85a084?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/f7c4bc85a084</guid>
            <category><![CDATA[hyperparameter-tuning]]></category>
            <category><![CDATA[gridsearchcv]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[grid-search]]></category>
            <dc:creator><![CDATA[María Guerra]]></dc:creator>
            <pubDate>Wed, 30 Oct 2024 19:20:57 GMT</pubDate>
            <atom:updated>2024-10-30T19:20:56.935Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9MFsncblTLRepwFIkCrk3Q.png" /><figcaption>Header Image</figcaption></figure><p>In machine learning, selecting the appropriate model and tuning hyperparameters are fundamental for achieving optimal results. GridSearchCV is a powerful tool that automates these processes, saving time and improving accuracy. This tutorial will guide you through the use of GridSearchCV, explaining its functionality, advantages, and practical applications. You will learn how to set up your environment, prepare data, and apply GridSearchCV both for a specific algorithm and to compare multiple models.</p><p>The purpose of this tutorial is to provide a deep understanding of GridSearchCV and its implementation in Python. By the end of this tutorial, you will be able to configure and use GridSearchCV for one or multiple algorithms, interpret the results to select the best model and its hyperparameters, and achieve machine learning model optimization efficiently and automatically.</p><p>To follow this tutorial, it is recommended to have basic knowledge of Python and fundamental machine learning concepts, including classification, cross-validation, and evaluation metrics. We will be using the scikit-learn library to implement GridSearchCV and various machine learning algorithms, pandas for data handling and processing, seaborn to load the example dataset, and numpy for numerical operations.</p><p>Whether you’re a beginner or an expert, this tutorial will provide you with the necessary skills to efficiently optimize your machine learning models.</p><h4><strong>What is GridSearchCV and how does it work?</strong></h4><p>GridSearchCV is a technique used in Machine Learning to find the optimal hyperparameters of a model based on the dataset to be used. In this method, the user establishes a grid of hyperparameters which is used to evaluate multiple possible combinations and select the best one based on a performance metric specified by the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*7QcWSS6aXq8BdX_g" /><figcaption>Source: <a href="https://doi.org/10.3390/buildings12050550">Shear Strength Prediction of Slender Steel Fiber Reinforced Concrete Beams Using a Gradient Boosting Regression Tree Method</a></figcaption></figure><p>There are several alternative methods for hyperparameter tuning, each with its own advantages in different scenarios. For example, RandomizedSearchCV randomly selects combinations of hyperparameters, being more efficient than GridSearchCV in large search spaces. On the other hand, we have Bayesian optimization, which uses probabilistic models to predict the most promising combinations.</p><p>GridSearchCV is ideal for small to medium search spaces and when sufficient computational resources are available. It is particularly useful when deterministic and reproducible results are needed, or when seeking to thoroughly understand the impact of each hyperparameter combination. This method is suitable for smaller-scale problems with smaller datasets or less complex models. In contrast, for larger search spaces or when computation time is limited, methods like RandomizedSearchCV or Bayesian optimization may be more appropriate. The choice of method will depend on the balance between search thoroughness, available time, and computational resources. GridSearchCV offers a complete search and is ideal for thoroughly understanding the hyperparameter space, but it can become inefficient for more complex problems where more advanced methods may offer a better balance between exploration and computational efficiency.</p><p>The following comparative chart provides an overview of the three main hyperparameter tuning methods mentioned above. This table can serve as a valuable guide when selecting the most appropriate approach for your specific machine learning project. Each column represents a key feature to consider, allowing you to evaluate which method best aligns with the needs and constraints of your particular problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ut3EueoPWRprorrPG0BoNg.png" /></figure><h4><strong>What is Cross-validation?</strong></h4><p>This is a statistical method used to estimate the ability of machine learning models. Its process includes splitting the dataset, training the model on a portion of the data, and validating it on the remaining portion. This cycle is repeated multiple times to ensure the model’s performance is consistent and that each data point has a chance to be validated against the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/0*2IuOVGSYPX72R29L" /><figcaption>Source: <a href="https://scikit-learn.org/stable/modules/cross_validation.html">Scikit-Learn User Guide</a></figcaption></figure><p>As we mentioned before, when using GridSearchCV all combinations of the values ​​in the hyperparameter grid are tested and the model is evaluated in each combination, due to the use of the cross-validation method.</p><h4><strong>Advantages of using GridSearchCV</strong></h4><ul><li>Exhaustively searches through each parameter combination</li><li>Once configured, it runs without manual intervention to tune the model</li><li>Helps find the best hyperparameters of a model, potentially improving its performance</li><li>Its configurability allows control over desired hyperparameter combinations</li></ul><h4><strong>Common Use Cases</strong></h4><ul><li>Hyperparameter tuning for Machine Learning algorithms</li><li>Optimization of Deep Learning model architectures</li><li>Selection of the best algorithm for a specific dataset</li></ul><h4><strong>Some Limitations</strong></h4><ul><li>Can be time and resource-intensive with large parameter grids</li><li>Care must be taken not to overfit the validation set</li><li>Performance may degrade with too many parameters, in other words, the “curse of dimensionality”</li></ul><h4><strong>Common Errors when using GridSearchCV and their Solutions</strong></h4><p>1. Defining too broad a search space, which can result in excessively long execution times</p><p>Solution: Start with a narrower range of hyperparameters and gradually refine</p><p>2. Overfitting, which can occur when using an inappropriate evaluation metric or when cross-validation is not properly implemented</p><p>Solution: Carefully select the evaluation metric depending on the problem and ensure proper cross-validation configuration</p><p>3. Memory errors, especially with large datasets or complex models</p><p>Solution: Reduce dataset size, use batch processing, or consider alternatives like RandomizedSearchCV</p><p>4. Misinterpretation of results, as the best model according to GridSearchCV may not necessarily be the best for unseen data</p><p>Solution: Perform additional validation with a separate test dataset</p><p>5. Lack of reproducibility can be an issue if a random seed is not set</p><p>Solution: Fix the random seed for both the model and data splitting to ensure consistent results</p><h4><strong>How to use GridSearchCV?</strong></h4><p>In this tutorial, I’ll be using Jupyter Notebook integrated into Visual Studio Code, running a Python 3.12 kernel. To make it easier to follow along and allow for a more detailed exploration, the source code is already available in our <a href="https://github.com/AccelAI/AI-Tutorials/tree/main/GridSearchCV_Tutorial">GitHub repository</a>. Please check it out if you want to follow the tutorial step-by-step or dig deeper into specific aspects of the code.</p><ol><li><strong>Environment setup: Install and import the necessary libraries.</strong></li></ol><p>First, we will install the Scikit-Learn, pandas, seaborn, matplotlib and numpy libraries in our virtual environment with the following command:</p><pre>pip install scikit-learn pandas seaborn matplotlib numpy</pre><p>GridSearchCV comes from the Scikit-Learn python library, while we will be using the Pandas library for dataset management and Seaborn to import the dataset.</p><p>Then we import the installed libraries and the functions to use:</p><pre>from sklearn.model_selection import GridSearchCV, train_test_split<br>import seaborn as sns<br>import numpy as np<br>import pandas as pd<br>from sklearn.tree import DecisionTreeClassifier<br>from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier<br>from sklearn.neighbors import KNeighborsClassifier<br>from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay<br>from matplotlib import pyplot as plt</pre><p><strong>2. Prepare the dataset</strong></p><p>For this example, we will be using the “healthexp” dataset from the Seaborn library and our target variable will be the “Country” column. This dataset was selected due to its manageable size and its combination of numerical and categorical features, making it ideal for demonstrating the use of GridSearchCV without requiring extensive computational resources. Its content, which relates health expenditure to life expectancy in different countries, provides an interesting and accessible context for a wide audience.</p><p>In this case, I decided to use the “dropna” function to filter and remove null values ​​from the dataframe.</p><pre>target_variable = &quot;Country&quot;<br>df = sns.load_dataset(&quot;healthexp&quot;)<br>df.dropna(inplace=True)<br>X = df.drop(target_variable, axis=1)<br>y = df[target_variable]</pre><p>And then we split the data into training and test sets.</p><pre>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)</pre><p><strong>3. Parameter grid</strong></p><p>Before diving into the code, let’s first define what hyperparameters are and what this grid received by the GridSearchCV function consists of.</p><p>Hyperparameters are external configuration parameters to a machine learning model that are not learned directly from the data during training; they control the learning process and the structure of the model. Unlike the regular parameters of the model, hyperparameters are set before training and affect how the model learns from the data.</p><p>The “grid” in GridSearchCV is essentially a dictionary or list of dictionaries that specifies the values ​​to be tested for each hyperparameter. In this tutorial, two distinct approaches to using grids will be shown: The first will focus on hyperparameter tuning for a specific algorithm, while the second will focus on selecting the most efficient algorithm within a set, along with optimizing their respective hyperparameters. These two strategies will allow us to explore both individual model optimization and comparison and selection between multiple algorithms.</p><pre># EXAMPLE<br>param_grid = {<br>    &#39;C&#39;: [0.1, 1, 10, 100],<br>    &#39;kernel&#39;: [&#39;rbf&#39;, &#39;linear&#39;],<br>    &#39;gamma&#39;: [&#39;scale&#39;, &#39;auto&#39;, 0.1, 1]<br>}</pre><p>In this example of a grid for an SVM classifier, GridSearchCV will test all the combinations of these values, resulting in 4 * 2 * 4 = 32 different hyperparameter combinations.</p><p><strong>4. Implementation of GridSearchCV</strong></p><p>Before starting, I recommend reviewing the original <a href="https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html">documentation</a> of GridSearchCV to better understand the parameters passed to the function. Here is a brief summary of each one:</p><ol><li>estimator: Pass the model instance for which you want to check the hyperparameters.</li><li>params_grid: The dictionary object that holds the hyperparameters you want to try (Our parameter grid)</li><li>scoring: Evaluation metric that you want to use. You can simply pass a valid string/object of evaluation metric.</li><li>cv: Number of cross-validation you have to try for each selected set of hyperparameters.</li><li>verbose: You can set it to 1 to get the detailed print out while you fit the data to GridSearchCV.</li><li>n_jobs: number of processes you wish to run in parallel for this task. If it is -1, it will use all available processors.</li></ol><p>(Great Learning Editorial Team, 2024)</p><p>Now, let’s continue with the implementation!</p><blockquote><strong><em>For a specific algorithm</em></strong></blockquote><pre># Define the base model, in this case we will use Random Forest Classifier<br>rf = RandomForestClassifier(random_state=23)<br><br># Define the parameter grid<br>param_grid = {<br>    &#39;n_estimators&#39;: [50, 100, 200],<br>    &#39;max_depth&#39;: [None, 5, 10],<br>    &#39;min_samples_split&#39;: [2, 5, 10],<br>    &#39;min_samples_leaf&#39;: [1, 2, 4]<br>}<br><br># Configure GridSearchCV<br>grid_search = GridSearchCV(estimator=rf, param_grid=param_grid, cv=5, scoring=&#39;accuracy&#39;, n_jobs=-1, verbose=2)<br><br># Fit GridSearchCV<br>grid_search.fit(X_train, y_train)<br><br># Evaluate the model with the best parameters on the test set<br>best_model = grid_search.best_estimator_<br>test_accuracy = best_model.score(X_test, y_test)</pre><p>Don’t worry if the code takes a while to run, as this depends on the size of the dataset and our grid. Try modifying the number of parameters used in the example to see the difference 😉.</p><p>Now, let’s continue with the visualization of the results:</p><pre># Display the best parameters and the best score<br>print(f&#39;Best parameters: {grid_search.best_params_}&#39;)<br>print(f&#39;CV Score: {round(grid_search.best_score_,2)}&#39;)<br>print(f&#39;Test Score: {round(test_accuracy,2)}&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vbasePZTboz4VM2-" /><figcaption>Output on the console with the best parameters and scores</figcaption></figure><pre># Predict the labels of the test set<br>y_pred = best_model.predict(X_test)<br><br># Compute the confusion matrix<br>cm = confusion_matrix(y_test, y_pred)<br><br># Show the confusion matrix<br>disp = ConfusionMatrixDisplay(<br>    confusion_matrix=cm, display_labels=best_model.classes_)<br>disp.plot(cmap=&#39;Blues&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*InsGd_aAfUunHPFc" /><figcaption>Confusion matrix for Random Forest model</figcaption></figure><p>As we can see from the output, the best parameters to use for this dataset with the Random Forest model are: ‘max_depth’=’None’, ‘min_samples_leaf’=1, ‘min_samples_split’=2, and ‘n_estimators’=200. This time, we achieved a test set score of 0.67 and a cross-validation score of 0.72. Can we achieve a better score using other models? Let’s find out!</p><blockquote><strong><em>To find the most optimal algorithm within a set</em></strong></blockquote><p>Implementing GridSearchCV for multiple algorithms can be a bit complex, so in this case, we will go step by step.</p><ol><li><strong>Definition of models and parameters:</strong></li></ol><pre># Define the models and their respective parameters for GridSearchCV<br>models = [<br>    (&quot;Decision Tree&quot;, DecisionTreeClassifier(random_state=23), <br>        {&#39;max_depth&#39;: range(1, 15)}),<br>    (&quot;Random Forest&quot;, RandomForestClassifier(random_state=23), <br>        {&#39;n_estimators&#39;: [50, 100, 200, 300], &#39;max_depth&#39;: [None, 2, 3, 5, 7, 10]}),<br>    (&quot;Gradient Boosting&quot;, GradientBoostingClassifier(random_state=23), <br>        {&#39;n_estimators&#39;: [50, 100, 200], &#39;learning_rate&#39;: [0.01, 0.1, 1]}),<br>    (&quot;K Nearest Neighbors&quot;, KNeighborsClassifier(), <br>        {&#39;n_neighbors&#39;: [3, 5, 7, 10]})</pre><p>First, we’ll define a list of tuples, where each one will have the model name, the model instance, and a dictionary with the parameters of that model to be used in GridSearchCV. In this example, we will work with 4 models: Decision Tree, Random Forest, Gradient Boosting, and K Nearest Neighbors, all classifiers. For the hyperparameters of the Random Forest in this case, we will only focus on n_estimators and max_depth to see if we obtain any change compared to the previous example.</p><p><strong>2. Training, evaluation, and selection of the best model:</strong></p><pre># Initialize dictionaries and variables to store results<br>results = {}<br>best_models = []<br>best_stability = np.inf<br>best_test_score = -np.inf  # For classification, we want to maximize the score<br><br># Iterate over each model and its parameters<br>for name, model, params in models:<br>    # Configure and fit GridSearchCV<br>    grid = GridSearchCV(estimator=model, param_grid=params,<br>                        cv=5, scoring=&#39;accuracy&#39;, verbose=1)<br>    grid.fit(X_train, y_train)<br>    test_score = grid.score(X_test, y_test)<br><br>    # Calculate model stability (difference between best cross-validation score and test score)<br>    stability = abs(grid.best_score_ - test_score)<br><br>    # Store the current model&#39;s results<br>    results[name] = {<br>        &quot;best_cv_score&quot;: round(abs(grid.best_score_), 2),<br>        &quot;test_score&quot;: round(abs(test_score), 2),<br>        &quot;stability&quot;: round(stability, 2),<br>        &quot;best_params&quot;: grid.best_params_,<br>    }<br><br>    # Update the best model if necessary<br>    if test_score &gt; best_test_score or (test_score == best_test_score and stability &lt; best_stability):<br>        best_test_score = test_score<br>        best_cv_score = grid.best_score_<br>        best_stability = stability  # Update the best stability<br>        # Start a new list of best models<br>        best_models = [<br>            (name, grid.best_params_, round(best_cv_score, 2), round(best_test_score, 2))<br>        ]<br>    elif test_score == best_cv_score:<br>        best_models.append((name, grid.best_params_))  # Add the current model to the best models list<br><br># Confusion matrix for each of the models<br>y_pred_best = grid.predict(X_test)<br>cm_best = confusion_matrix(y_test, y_pred_best)<br>disp_best = ConfusionMatrixDisplay(confusion_matrix=cm_best, display_labels=grid.best_estimator_.classes_)<br>disp_best.plot(cmap=&#39;Blues&#39;)<br>plt.title(f&#39;Confusion Matrix for {name}&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*2OiVHp9sO9gkmf2X" /><figcaption>Confusion Matrix for Decision Tree model</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*LbNKOvkfjyWsRwWZ" /><figcaption>Confusion Matrix for Random Forest model</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/0*uFI4yGe_8zz1tLli" /><figcaption>Confusion Matrix for Gradient Boosting model</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*X3VL6nzBdkfyHVcz" /><figcaption>Confusion Matrix for K Nearest Neighbors model</figcaption></figure><p>This part of the tutorial may take significantly longer than the previous one, as we are performing Grid Search on four different models.</p><p><strong>Notes:</strong></p><ul><li>The score on the test set and stability are calculated, with stability being the difference between the best cross-validation score and the test score.</li><li>The best model is updated based on the test score and stability.</li><li>In case of a tie in the score, multiple models are considered as “best”.</li></ul><p><strong>3. Final results:</strong></p><p>In the code, the results are saved in the following variables:</p><ul><li>best_stability: Contains the stability of the best model(s).</li><li>best_models: A dictionary containing the best model(s) for the dataset along with their optimal parameters and scores.</li><li>results: A dictionary with all the results of each evaluated model.</li></ul><p>In our Jupyter Notebook (<a href="https://github.com/AccelAI/AI-Tutorials/tree/main/GridSearchCV_Tutorial">link to the repository</a>), these can be visualized as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/0*SHgNdGCabwXgfLJG" /><figcaption>Output on the console with the best model, its scores and the best parameters</figcaption></figure><p>The results confirm that the Random Forest model remains the most effective option among the algorithms evaluated for this dataset. This model maintained its robust and consistent performance, achieving a cross-validation score of 0.72 and a test set score of 0.67.</p><p>Interestingly, these results are identical to those obtained in our previous example, suggesting that we had already reached an optimal level of performance with our initial configuration. The decision to focus specifically on the hyperparameters ‘max_depth’ and ‘n_estimators’ during this new tuning process did not lead to additional improvements, indicating that the original calibration was already quite accurate.</p><p>This experience highlights the importance of recognizing when a satisfactory level of optimization has been reached. It demonstrates that further adjustments are not always necessary if good performance has already been achieved. In future analyses, it will be valuable to consider this finding and carefully evaluate whether further iterations of optimization are needed or if resources might be better utilized in other aspects of the model or in exploring different approaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*lg3MBMkmVdoYjFN2" /><figcaption>Table with the performance of each model</figcaption></figure><p>In this table, we can visualize the performance of each tested model and their respective parameters. We can conclude that the Random Forest model shows the best performance among all the evaluated models, with the highest scores in both cross-validation (CV) and the test set. Although it doesn’t have the perfect stability of Gradient Boosting, its stability of 0.05 is very good, indicating that the model generalizes well and does not suffer from overfitting.</p><h4><strong>Optimizing GridSearchCV Performance</strong></h4><p>To reduce the computational load when using GridSearchCV, there are several effective strategies, such as using a smaller subset of the dataset for the initial hyperparameter tuning. This allows for rapid exploration of the hyperparameter space, identifying promising areas that can later be refined with the full dataset. Another common technique is parallelizing the search using the n_jobs parameter in GridSearchCV. By setting n_jobs=-1, all available processor cores are utilized, significantly speeding up the search process. Additionally, a two-stage search strategy can be implemented: first, a broad but shallow search to identify promising regions, followed by a more detailed search in these areas.</p><p>When it comes to hyperparameter selection, it is crucial to focus on those that have the most significant impact on the model’s performance. For example, in tree-based models like Random Forest or Gradient Boosting, parameters such as the maximum tree depth, the number of estimators, and the learning rate are often critical. It is advisable to start with a wide range for these key parameters and then refine them based on initial results. It is also useful to consult literature and previous studies on similar problems to gain insights into which hyperparameters tend to be most impactful for each type of model and specific problem.</p><h4><strong>Key points to remember:</strong></h4><ul><li>GridSearchCV automates the search for the best combination of hyperparameters, significantly improving model performance.</li><li>The choice between GridSearchCV and other methods like RandomizedSearchCV mainly depends on the search space size and available computational resources.</li><li>It is crucial to carefully select the range of hyperparameters to explore, focusing on those with the most significant impact on model performance.</li><li>Techniques like parallelization (n_jobs) and the use of data subsets can significantly reduce computation time.</li><li>GridSearchCV is a versatile tool applicable to a wide range of machine learning algorithms, from simple regressions to more complex models.</li></ul><p>Throughout this tutorial, we delved into the importance of model selection and hyperparameter tuning in the realm of machine learning, and we learned that GridSearchCV is a fundamental tool that automates these processes, allowing users to evaluate multiple hyperparameter combinations systematically and efficiently. We covered the basics of GridSearchCV, its functionality, and its advantages, as well as alternative techniques that may be more suitable in certain contexts.</p><p>If you’ve made it this far, it means you are now equipped to implement GridSearchCV in your own machine learning projects, interpret the obtained results, and apply a systematic approach to model optimization. With this foundation, you will be better prepared to tackle machine learning challenges and continue developing your skills in this ever-evolving field.</p><h4><strong>Conclusion</strong></h4><p>The importance of hyperparameter tuning and algorithm selection in machine learning cannot be underestimated. As we saw in this tutorial, implementing GridSearchCV allows us to automate these crucial processes, leading to more robust and accurate models. This can be practically applied in various fields. For example, in credit card fraud detection, optimizing classification models like Random Forest or SVM by tuning key parameters enhances the identification of fraudulent transactions. In customer segmentation for marketing, GridSearchCV is applied to clustering algorithms like K-Means, refining parameters to achieve more meaningful segmentations. In housing price prediction, it optimizes regression models like Gradient Boosting or Neural Networks, minimizing prediction error. In these and many other cases, GridSearchCV helps find the optimal combination of hyperparameters, improving model performance and increasing prediction accuracy for specific real-world problems. However, it’s also crucial to be aware of common errors, such as overfitting the validation set, defining too broad search spaces, or misinterpreting results. These errors can be avoided through nested cross-validation, a two-stage search strategy, or a deep understanding of the evaluation metrics used. By keeping these potential errors in mind, GridSearchCV’s effectiveness in real-world applications can be maximized.</p><p>GridSearchCV facilitates a systematic and objective way to compare different algorithms, helping us choose the most suitable one for our specific dataset. Although the process can be computationally intensive, it automates a task that would be extremely tedious and error-prone if done manually, saving valuable time and resources.</p><p>Looking ahead, several steps and alternatives can be considered to expand and improve our approach. These include exploring wider hyperparameter spaces, adding more values or even additional hyperparameters for each algorithm. While GridSearchCV is effective, alternatives like RandomizedSearchCV or Bayesian optimization methods can be more efficient for larger hyperparameter spaces and are worth investigating.</p><p>Exploring other metrics relevant to a specific problem, such as F1-score, AUC-ROC, or domain-specific metrics, can also provide a more complete picture of model performance. Finally, a crucial step would be exploring how to integrate this model selection and tuning process into a production machine learning workflow, taking our findings from theoretical to practical application.</p><p>By adopting a systematic approach and exploring various tools and techniques, you’ll be better prepared to face machine learning challenges and continuously improve your skills 😁.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzmVO_Pm8yYRJcdie_kzrQ.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><h4>References</h4><p>DigitalSreeni. (2023). <em>300 — Picking the best model and corresponding hyperparameters using Gridsearch</em> [Video]. YouTube. <a href="https://www.youtube.com/watch?v=cOos6wRMpAU">https://www.youtube.com/watch?v=cOos6wRMpAU</a></p><p>Great Learning Editorial Team. (2024). Hyperparameter Tuning with GridSearchCV. <em>Great Learning.</em> <a href="https://www.mygreatlearning.com/blog/gridsearchcv/">https://www.mygreatlearning.com/blog/gridsearchcv/</a></p><p>Dremio. (2024). <em>What is Grid Search? </em><a href="https://www.dremio.com/wiki/grid-search">https://www.dremio.com/wiki/grid-search</a></p><p>Verma, A. (2023). <em>GridSearchCV in scikit-learn: A Comprehensive Guide</em>. DEV Community. <a href="https://dev.to/anurag629/gridsearchcv-in-scikit-learn-a-comprehensive-guide-2a72">https://dev.to/anurag629/gridsearchcv-in-scikit-learn-a-comprehensive-guide-2a72</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7c4bc85a084" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/automating-model-selection-and-hyperparameter-tuning-with-gridsearchcv-f7c4bc85a084">Automating Model Selection and Hyperparameter Tuning with GridSearchCV</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Climate Change and Agriculture: Can AI Help?]]></title>
            <link>https://medium.com/accel-ai/climate-change-and-agriculture-can-ai-help-83c5a03efa29?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/83c5a03efa29</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agriculture]]></category>
            <category><![CDATA[climate-change]]></category>
            <dc:creator><![CDATA[Jennafer Shae Roberts]]></dc:creator>
            <pubDate>Mon, 02 Sep 2024 00:19:03 GMT</pubDate>
            <atom:updated>2024-09-02T00:21:25.905Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MENJTAwT9cqVMei2h8JEXg.png" /></figure><p>Climate change poses a significant threat to global food security, with agriculture both contributing to and being impacted by this crisis. Extreme weather events, shifting precipitation patterns, and rising temperatures disrupt crop yields and threaten livelihoods. Simultaneously, traditional agricultural practices contribute to greenhouse gas emissions, exacerbating climate change.</p><p>Artificial intelligence (AI) presents some interesting tools that allow us to address these interconnected challenges. By analyzing vast datasets and identifying patterns, AI can support more informed decision-making in agriculture. For example, AI-powered tools can help farmers optimize resource use, predict crop yields, and adapt to changing climate conditions.</p><p>However, realizing the full potential of AI requires careful consideration. Challenges such as data access, privacy, and ethical implications must be addressed. Additionally, ensuring that AI benefits are distributed equitably is crucial.</p><p>While AI is a promising tool, it is essential to remember that it is not a standalone solution. Human expertise, policy interventions, and sustainable practices remain indispensable for building resilient and sustainable food systems. By combining human ingenuity with AI’s capabilities, we can make changes in order to mitigate and adapt to the increasing challenges of climate change.</p><p>This blog is inspired by a series of courses I have taken for <a href="https://www.climatechange.ai/events/summer_school2024">Climate Change AI Summer School</a>. I wanted to explore some of the ways that AI and machine learning (ML) are being used to reach emission reduction targets and make necessary changes without causing harm. AI should be carefully considered for each potential project, as simpler solutions are often more effective, cost-efficient, or have less detrimental environmental or social impact. AI is certainly not going to solve these problems on its own. There is much work to be done to understand and integrate these systems and apply them in appropriate ways, while addressing the sociotechnical as well as purely social issues along the way.</p><h3>About Climate Change and AI</h3><p>The climate crisis demands urgent and innovative solutions. The Intergovernmental Panel on Climate Change (IPCC) has made it clear that drastic reductions in greenhouse gas emissions (GHGs) are imperative to avert catastrophic global warming. While the challenge is immense, technology offers potential pathways forward.</p><p>Machine Learning (ML), which enables computers to learn from data without explicit programming, has far-reaching applications in climate science, mitigation, and adaptation. From predicting extreme weather events to optimizing renewable energy systems, ML can provide invaluable insights and support decision-making. However, it’s crucial to recognize that ML is not a panacea. Challenges such as data bias, model interpretability, over-surveillance, and the potential for unintended consequences must be carefully considered. By understanding both the promise and limitations of ML, we can harness its power to create a more sustainable future.</p><p>In this series of posts, we will explore the potential of ML in addressing climate change, examining its applications across various sectors and discussing the critical factors for successful implementation.</p><p>This blog is the first of a series on the different courses that I attended over the summer. The courses started with an <a href="https://www.youtube.com/watch?v=4HkJj3DFLgs">Introduction to Climate Change and AI</a>, followed by <a href="https://youtu.be/99U0ePt9DzY">AI for Agriculture, Forestry, and Other Land Use</a> which will be the topic for this blog. Next they covered <a href="https://youtu.be/I9TIRncO9HE">AI for Biodiversity and Ecosystems</a>; <a href="https://youtu.be/q-rbAyZuZjo">AI for Social Sciences; Economics and Policy</a> part 1 and <a href="https://youtu.be/jJsRRDy3WHQ">part 2</a>;<a href="https://www.youtube.com/watch?v=P5_R_5kJDas"> AI for Climate Science</a>; <a href="https://youtu.be/j3_jE0ZqsMM">AI for Monitoring, Reporting, and Verification</a>; <a href="https://www.youtube.com/watch?v=v3M4gdU83Z8">Ethics, Impacts, and Regulation of AI</a>; <a href="https://www.youtube.com/watch?v=RJ__2-qViCM">AI for Buildings and Cities</a>; <a href="https://www.youtube.com/watch?v=G5VuaWaYsLU">GHG Impact Assessment of AI</a>; <a href="https://youtu.be/L8CYBqgAPAc">AI for Power and Energy Systems</a>; <a href="https://youtu.be/i23jr7pkjsM">AI for Transportation</a>;<a href="https://youtu.be/3mtbFx_8VVc"> and finally Climate, Health, and AI</a>. All in all, there were 13 courses of lectures over 6 weeks from expert presenters on the cutting edge of these areas of AI for climate change. The links on each of these will take you to the actual courses if you are interested in learning for yourself. They are long and in-depth but totally worth the time! However, here I will be summarizing them for you and sharing my key takeaways.</p><p>Be on the lookout for upcoming blog posts covering useful information on each of these topics. For this blog, we will focus on AI for agriculture and climate change.</p><p><strong>Agriculture and Climate Change: Where does AI come in?</strong></p><p>You may have heard about robots being used on farms, but AI for agriculture has many more uses than that. When approaching this, it is first important to note that agriculture and climate change are a two-way street. Agriculture is both highly vulnerable to climate change (changing temperatures, extreme weather, reduced water) and a major contributor (methane emissions, fertilizers, land-use changes). As climate change intensifies, this creates more and more food insecurity. There is much work to be done to prevent this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UiHL0lNPdRoUlUsM" /><figcaption>One way AI can interpret satellite imagery to give information on what is cropland and not cropland, image from <a href="https://www.climatechange.ai/events/summer_school2024">Climate Change AI Summer School</a></figcaption></figure><p><strong>Understanding ML for Climate Change and Agriculture</strong></p><p>Many advancements in AI have useful applications for climate change and agriculture, such as machine learning. Techniques like remote sensing, coupled with ML, enable us to monitor vast areas, detect changes in land use, and assess crop health on a global scale. Precision agriculture, another application, leverages AI to optimize resource management at the farm level, increasing efficiency and reducing environmental impact. While some AI solutions are globally applicable, such as climate modeling and satellite imagery analysis, others are tailored to specific regions and crops, demonstrating the versatility of this technology in addressing diverse agricultural challenges. However, data is not equally available everywhere, and not as easily applied on the ground.</p><p>While satellite technology and AI offer immense potential for revolutionizing agriculture and ensuring food security, their impact is unevenly distributed. The availability of high-resolution satellite data is significantly higher in the Global North compared to the Global South, limiting the ability of farmers and policymakers in these regions to leverage these technologies to their full potential. Additionally, the specific agricultural challenges faced by different socioeconomic contexts vary widely. For instance, smallholder farmers in developing countries often prioritize short-term yields and subsistence, while large-scale commercial farms in developed countries may focus on maximizing profits, where everyone needs to be prioritizing environmental sustainability. These diverse needs require tailored AI solutions and data infrastructure to be truly effective.</p><p>Moreover, the digital divide further exacerbates these disparities. Access to technology and digital literacy are essential for farmers to utilize AI tools effectively. Bridging this gap is crucial for ensuring that the benefits of AI in agriculture are shared equitably across the globe.</p><p><strong>AI for Informed Decisions: Who Benefits?</strong></p><p>One way that AI can be helpful is in providing information and making decisions based on the data available, such as tracking satellite data or using a farm’s localized data. This holds different benefits for different stakeholders, such as for farmers and policymakers. Generally, farmers are concerned about their individual farms and keeping them running efficiently and producing crops, whereas policymakers are concerned about food security and climate impact for the masses.</p><h3>Delivering Information to Decision Makers</h3><p>To effectively address climate change, it’s crucial to deliver timely and accurate information to those who can make a difference. Decision-makers such as farmers, policymakers, aid organizations, and industries require data-driven insights to inform their strategies. Farmers, for instance, grapple with questions about crop yield, weather patterns, soil moisture, and pest management. Climate change is altering traditional farming practices, making it increasingly difficult to predict optimal planting times and manage water resources effectively. By providing farmers with AI-powered tools to forecast weather, assess soil conditions, and predict crop performance, it can help them adapt to these challenges and ensure food security.</p><p>Policymakers, on the other hand, need a broader perspective. They require data on long-term climate impacts as well as data to track the resilience of agricultural systems and the interplay between agriculture and climate change. AI can help policymakers understand the data to address how climate change will affect livelihoods, water usage, and food production on a larger scale. By identifying regions vulnerable to climate shocks and analyzing the effectiveness of different policies, policymakers can make informed decisions to mitigate risks and build resilience.</p><p><strong>Examples of AI in Action</strong></p><p>Several initiatives have successfully harnessed AI to deliver valuable information to decision-makers. <a href="https://nasaharvest.org/">NASA Harvest</a>, for example, provides global-scale agricultural data, enabling policymakers to track crop production and identify potential food shortages. Similarly, the <a href="https://fews.net/">Famine Early Warning Systems Network</a> (FEWS NET) uses AI to forecast the impact of climate shocks on vulnerable populations, helping aid organizations allocate resources effectively. These examples demonstrate the potential of AI to inform decision-making and improve outcomes.</p><p>To fully realize the benefits of AI in agriculture, addressing challenges such as data availability, model generalizability, and effective communication with end-users is essential. By investing in research and development, building strong partnerships between scientists, farmers, and policymakers, and prioritizing the ethical use of AI, we can unlock its potential to create a more sustainable and resilient food system.</p><p>Many examples were given in the course of situations where AI is already being utilized to assist with climate change and agriculture. Some of the applications aim to make sure that farming is efficient and thus not adding unnecessarily to greenhouse gas emissions (GHGs), and some of the case studies provide ways to cope with the changing climate.</p><p><strong>Harvest AI and Acres AI: Global and US Crop Monitoring</strong></p><p><a href="https://nasaharvest.org/">NASA Harvest</a> and <a href="https://www.nasaacres.org/">NASA Acres</a> are pioneering initiatives leveraging satellite data and AI to monitor crop conditions on global and national scales, respectively.</p><p>Harvest AI takes a worldwide perspective, utilizing satellite imagery to track crop health, predict yields, and assess agricultural risks. By analyzing vast datasets, Harvest AI provides valuable insights to policymakers, aid organizations, and farmers in making informed decisions about food security and resource management.</p><p>On a more localized level, NASA Acres focuses specifically on the United States. By harnessing satellite data and advanced analytics, Acres AI supports American farmers in optimizing their agricultural practices. This initiative provides critical information on crop conditions, soil moisture, and weather patterns, enabling farmers to make data-driven decisions that improve yields, conserve resources, and mitigate the impacts of climate change.</p><p>Both Harvest AI and Acres AI exemplify the potential of satellite technology and AI to revolutionize agriculture and ensure food security. However, it’s essential to consider the potential privacy implications of such large-scale data collection and analysis.</p><p><strong>FEWS NET: Early Warning for Food Security</strong></p><p><a href="https://www.un-spider.org/famine-early-warning-systems-network-fewsnet">FEWS NET</a>, the Famine Early Warning Systems Network, is a critical tool in the fight against food insecurity and humanitarian crises. By leveraging AI and advanced data analysis, FEWS NET is able to forecast the impact of climate and weather shocks on vulnerable populations. The network currently monitors food security conditions in over 35 countries across Africa, Central Asia, Central America, and Haiti. For example, the network can predict the potential consequences of flooding in Kenya, such as crop damage, displacement, and food shortages. The network accurately forecasted the devastating impact of desert locust swarms on crops and livelihoods in countries like Kenya, Ethiopia, and Somalia in 2019 and 2020. Additionally, FEWS NET has been instrumental in assessing the potential consequences of hurricanes in Central America, providing crucial early warnings to aid organizations and governments.</p><p>This early warning system allows humanitarian organizations, governments, and other stakeholders to anticipate crises, mobilize resources, and implement effective response plans. By understanding the potential impacts of climate shocks, FEWS NET helps to prevent food shortages from escalating into famines, saving lives and protecting livelihoods.</p><p><strong>Maui Food Security Project: Leveraging Satellite Data for Sustainable Agriculture</strong></p><p><a href="https://foodsecurityhawaii.org/">The Maui Food Security Project</a> is a prime example of how satellite data can be used to support sustainable agricultural practices. By extracting valuable information from satellite imagery, researchers and farmers can gain insights into crop health, soil conditions, and land use patterns. This data-driven approach enables more informed decision-making, leading to increased agricultural productivity and reduced environmental impact.</p><p>For instance, by analyzing satellite data, researchers can identify suitable areas for cultivation, optimize water usage, and detect potential pests or diseases early on. This information empowers farmers to make timely interventions, protecting their crops and maximizing yields. Moreover, satellite data can help monitor land use changes and identify opportunities for sustainable agriculture practices, such as agroforestry or organic farming.</p><p>Ultimately, the Maui Food Security Project demonstrates the potential of satellite technology to address food security challenges and promote sustainable agriculture on a local scale.</p><p><strong>Challenges and Ethical Considerations in AI for Agriculture</strong></p><p>The integration of AI into agriculture presents a complex landscape of opportunities and challenges. While technologies like satellite imagery and machine learning hold immense potential for enhancing crop yields, managing resources, and environmental sustainability, significant hurdles must be overcome.</p><p>One key challenge lies in the scarcity of high-quality, publicly accessible agricultural data, essential for training robust AI models. Overreliance on limited benchmark datasets can hinder model performance in real-world conditions. Additionally, the collection and use of data raise privacy concerns, particularly regarding satellite imagery. Safeguarding sensitive information while maximizing data-driven benefits is crucial.</p><p>Beyond data limitations, developing AI models that are reliable, interpretable, and explainable is essential for building trust among farmers and policymakers. Ensuring equitable access to AI technologies, especially in resource-constrained regions, is also imperative. Addressing technical, social, and ethical considerations is fundamental to unlocking AI’s full potential for a sustainable and equitable food system.</p><p>The primary source of risks in crop monitoring lies in the utilization of satellite image data. Here is one site where satellite data that is publicly available: <a href="https://browser.dataspace.copernicus.eu/">https://browser.dataspace.copernicus.eu/</a></p><p>The potential for misuse is significant, including economic espionage where competitors can gain a competitive edge by analyzing crop patterns and yields. Additionally, food security threats arise as malicious actors can exploit this data to manipulate markets or identify vulnerable regions. The combination of satellite data and advanced AI algorithms exacerbates these risks, as it allows for even more detailed and actionable insights to be extracted. To mitigate these risks, robust safeguards such as data anonymization, encryption, and strict access controls are necessary. This is an ongoing struggle with open source and publicly available data and AI. Is it worth the risks?</p><p><strong>Conclusion</strong></p><p>This blog has explored the potential of AI to address the complex challenges at the intersection of agriculture and climate change. By leveraging satellite data, machine learning, and other advanced technologies, we can gain valuable insights into crop health, weather patterns, and land use changes. These insights can inform decision-making for farmers, policymakers, and aid organizations, contributing to more resilient and sustainable food systems.</p><p>However, realizing the full potential of AI requires careful consideration of ethical, social, and environmental implications. Addressing challenges such as data privacy, model interpretability, and equitable access to technology is essential for building trust and ensuring that AI benefits all stakeholders.</p><p>As AI continues to evolve, ongoing research and development are crucial for addressing emerging challenges and unlocking new opportunities. By fostering collaboration between researchers, policymakers, farmers, and other stakeholders, we can harness the power of AI to create a more sustainable and equitable future for agriculture and the planet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzmVO_Pm8yYRJcdie_kzrQ.png" /><figcaption>Accel.AI Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83c5a03efa29" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/climate-change-and-agriculture-can-ai-help-83c5a03efa29">Climate Change and Agriculture: Can AI Help?</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ethics Revolution: How Can We Move Beyond Profit-Driven Data Practices?]]></title>
            <link>https://medium.com/accel-ai/the-ethics-revolution-how-can-we-move-beyond-profit-driven-data-practices-70f9a1649906?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/70f9a1649906</guid>
            <category><![CDATA[ai-ethics]]></category>
            <category><![CDATA[data-sovereignty]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-ethics]]></category>
            <category><![CDATA[responsible-ai]]></category>
            <dc:creator><![CDATA[Jennafer Shae Roberts]]></dc:creator>
            <pubDate>Thu, 04 Jul 2024 17:41:50 GMT</pubDate>
            <atom:updated>2024-07-04T17:41:50.445Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iueeSUbSM-ax-8O6VuN4GA.png" /></figure><p>Much gets lost in the sea of chatter about ethics for data and AI.</p><p>For instance, we aren’t talking enough about the unseen underpaid laborers behind the data that fuels Artificial Intelligence, not to mention how data is exploited from every one, with risks falling onto those who tend to be marginalized to begin with. These were some of the topics discussed on a recent conference panel that I was invited to speak at.</p><p>The panel, “<a href="http://vargas-solar.com/dei-sigmod-pods-panel/">Global Voices in Data: Navigating Responsible Management and Processing with Diverse Perspectives</a>,” took place at the <a href="https://2024.sigmod.org/">ACM DEI SIGMOD/PODS</a> conference in Chile. The panel aimed to facilitate a conversation involving a range of voices from both the Global North and South, to pinpoint essential elements that would enhance the progression of ethical and reliable research on databases. This involved taking into consideration the distinct requirements, expectations, and viewpoints of communities across various regions. The annual ACM SIGMOD/PODS Conference is a prominent global gathering for database researchers, practitioners, developers, and users to engage with the latest ideas and findings, and to share strategies, tools, and experiences. The conference’s audience includes individuals involved in research, industry, and development within the field of database technology, as well as representatives from leading companies. The event encompasses a diverse technical program featuring research and industrial talks, tutorials, demos, workshops, a poster session, industrial exhibition, and a careers-in-industry panel.</p><p>The discussion left me with a critical question: <strong>can we achieve an ethics revolution in data practices within a system driven by profit maximization?</strong></p><p>The panel discussions were rich and diverse. Ricardo Baeza Yates (Director of Research at the Institute for Experiential AI of Northeastern University and professor at the Dept. of Computer Science of the University of Chile) emphasized the importance of <strong>decolonial discourse</strong> and a <strong>multidisciplinary approach</strong>. Jocelyn Dunstan (a professor at the Catholic University of Chile in a joint appointment between the Department of Computer Science and the Institute for Mathematical and Computational Engineering) highlighted the need for <strong>personal awareness</strong> and systemic change from within. We all agreed on the importance of <a href="https://www.gida-global.org/"><strong>Indigenous Data Sovereignty</strong></a>, ensuring communities control their own data.</p><p>The participation of diverse voices, specifically from the Global South, brought value to the conversation surrounding responsible data analytics and AI. While discussions on responsible AI primarily come from the Global North and focus on technological perspectives, voices from the Global South are engaging in decolonial discourse that questions accountability and responsibility surrounding data exploitation techniques. These discussions highlight the unequal distribution of benefits from data processing and global colonization of data and include key concepts such as Indigenous Data Sovereignty, “counterdata”, and missing data.</p><p>Some of the points discussed that exemplify the importance of participation from the Global South were the attention to the existence of colonial influence on data, data labeling, exploitation through data, and data work. Having colonial labels on data, for instance, can be quite harmful to the people that the data represents. The principles of Indigenous Data Sovereignty can function as a framework that can guide data practices towards being responsible and ethical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/0*GBJ1_5p_QaBx_yb1" /></figure><p><strong>My Presentation: Decolonizing Data for an Ethical Future</strong></p><p>During my presentation, I explored the concept of <strong>Indigenous Data Sovereignty </strong>and its connection to responsible data practices. Traditional data practices often reflect colonial patterns of control and exploitation. To achieve truly ethical AI, we need to decolonize data by centering Indigenous knowledge and self-determination. The <a href="https://www.gida-global.org/care"><strong>CARE Principles</strong></a> (<strong>Collective Benefit, Authority to Control, Responsibility and Ethics</strong>) provide a framework for ethical data governance, particularly in relation to Indigenous communities. These principles ensure data projects benefit the community, respect their control over their knowledge, and are conducted ethically. They address a gap left by the <strong>FAIR Principles</strong> (Findable, Accessible, Interoperable, Reusable), which lack focus on Indigenous rights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*YcW0xGZOMTjhzrrg" /></figure><p><strong>The Responsibility Gap: Exploitation in Data Labeling</strong></p><p>Transparency and accountability are crucial for responsible data practices. Those handling data, especially Indigenous data, must demonstrate how their work upholds self-determination and collective benefit for the communities involved. The underpaid data workers labeling sensitive content exemplify the dangers of neglecting responsibility in data practices.</p><p><strong>The Path Forward: A Call to Collective Action</strong></p><p>Discussions around codifying and operationalizing AI ethics are a critical step toward responsible data management. By translating ethical principles into actionable practices, we can create a ripple effect that fosters a new, more ethical way of thinking about data and AI. This includes embracing diverse cultural perspectives and dismantling systems of bias, discrimination, and exploitation.</p><p><strong>But the question remains: <em>How</em> do we move beyond a system focused solely on profit?</strong></p><p>Currently, the focus on profit maximization often leads to <a href="https://www.researchgate.net/publication/372950694_The_Glamorisation_of_Unpaid_Labour_AI_and_its_Influencers">harmful practices</a>, such as:</p><ul><li>Paying data workers a pittance to label massive amounts of sensitive content, causing them psychological harm.</li><li>Exploiting communities through data collection without their knowledge or consent.</li><li>Perpetuating algorithmic bias through data that reflects historical inequalities.</li></ul><p><strong>The Need for a New Goal: <em>Do No Harm</em></strong></p><p>While AI has the potential to bring about positive change, there is also a possibility that it could negatively impact certain groups. It’s crucial to recognize that AI is just one tool among many, and a key initial step is determining whether it will be beneficial for a specific project.</p><p>Ethical considerations around data are paramount, as data can inadvertently lead to harm, such as in the case of revealing sensitive information through images like satellite imagery after a natural disaster.</p><p>It’s essential to handle data responsibly to prevent any leaks or unauthorized release of personal information, as there are real risks associated with compromised data, including potential misuse by authoritarian regimes for profiling and repressing dissidents.</p><p>Engaging with stakeholders is crucial to comprehensively understand potential negative effects, as seen in the example of tracking endangered species where the collected data could potentially be misused by illegal trackers. Therefore, it is imperative to apply the principle of “Do No Harm” and carefully consider the potential impacts on all those affected.</p><p>The current system prioritizes profit over people and the planet. We need to shift the goal of AI and data practices to <strong>“Do No Harm”</strong>, borrowed from the Hippocratic Oath which is the foundation of ethics in medicine and healthcare. For the growing field of AI, this requires a fundamental change from the beginning in how we approach data collection, labeling, use, and storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/0*WWFVMYyexlrQMBFd" /></figure><p><strong>It’s a Difficult Question, But We Can’t Avoid It</strong></p><p>Change can be daunting, but it’s necessary. The people and the planet deserve to be treated with dignity and respect. This should be the guiding principle for AI and data practices, not profit maximization. Achieving this will require a multi-pronged approach, including:</p><ul><li><strong>Empowering Communities:</strong> Indigenous communities and other marginalized groups should have control over their own data.</li><li><strong>Fair Compensation for Data Labor:</strong> Data workers deserve fair wages and protections.</li><li><strong>Transparency in Data Collection:</strong> People should know when and how their data is being collected and used.</li><li><strong>Algorithmic Auditing:</strong> We need to continually identify and mitigate bias in AI systems.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/0*vgY7ZiODegGEScXi" /></figure><p><strong>The Responsibility Lies With All of Us</strong></p><p>The conversation about ethics in AI and data practices needs to continue. We all have a role to play in demanding change. Corporate responsibility is huge, but the public can put pressure on corporations to shift their priorities in order to protect everyone. As with a lot of areas that need attention and change, the ability is there, but so is the apathy; and what is worse, assumed apathy of everyone else. It is extremely important to implement responsibility at the level we are now, and not wait until AI is much more powerful. It is vital that we pressure corporations to put more into responsibility than they do into profits and speed.</p><p><strong>Final Thoughts on the Panel</strong></p><p>It was an honor to be invited to speak on this panel and be a part of such important conversations about data responsibility and ethics. I hope that it spurs much thought and work in the community for others to join the ethics revolution.</p><p>If you are working with data, your part in this revolution is to abide by the CARE principles of Indigenous Data Sovereignty and to take the time to consider harms when working with data and AI. This needs to be done at all stages of the data lifecycle, especially when working with Indigenous data and data from the Global South. As a citizen of the world, ensure you are voting for representatives that consider regulation and policy that protects all people in the development of technology and put your money towards ethically developed AI products.</p><p>If you want to read more about my work in this area and ethics and AI more broadly, you can access my published works below.</p><ul><li><a href="https://link.springer.com/chapter/10.1007/978-3-031-47451-4_13">In Consideration of Indigenous Data Sovereignty: Data Mining as a Colonial Practice</a> (2023). Free access: <a href="https://arxiv.org/abs/2309.10215">arXiv:2309.10215</a></li><li><a href="https://www.semanticscholar.org/paper/Contextualizing-Artificially-Intelligent-Morality%3A-Roberts-Montoya/7ab0d7b3dc346ab890a4916d1e9ecc2292cd9b1c">Contextualizing Artificially Intelligent Morality: A Meta-Ethnography of Top-Down, Bottom-Up, and Hybrid Models for Theoretical and Applied Ethics in Artificial Intelligence</a> (2023). Free access: <a href="https://arxiv.org/abs/2204.07612">arXiv:2204.07612</a></li><li><a href="https://www.researchgate.net/publication/372950694_The_Glamorisation_of_Unpaid_Labour_AI_and_its_Influencers">The Glamorisation of Unpaid Labour: AI and its Influencers</a> (2023). Free access: <a href="https://arxiv.org/abs/2308.02399">arXiv:2308.02399</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lzmVO_Pm8yYRJcdie_kzrQ.png" /><figcaption>Accel AI Institute Logo</figcaption></figure><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70f9a1649906" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/the-ethics-revolution-how-can-we-move-beyond-profit-driven-data-practices-70f9a1649906">The Ethics Revolution: How Can We Move Beyond Profit-Driven Data Practices?</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The AI Regulation Race]]></title>
            <link>https://medium.com/accel-ai/the-ai-regulation-race-4a4a9fda6eec?source=rss----e39925390279---4</link>
            <guid isPermaLink="false">https://medium.com/p/4a4a9fda6eec</guid>
            <category><![CDATA[ai-ethics]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[ai-regulation]]></category>
            <dc:creator><![CDATA[Jennafer Shae Roberts]]></dc:creator>
            <pubDate>Mon, 20 May 2024 19:29:38 GMT</pubDate>
            <atom:updated>2024-07-04T17:46:13.186Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8fo-kFZNOrXRjKTFAerJxQ.png" /></figure><p>Can AI ever be truly safe?</p><p>As AI’s influence explodes in healthcare, finance, and beyond, regulations are being actively shaped with the aim of trustworthiness.</p><p>While the vast array of AI applications makes an easy safety measure impossible, the National Institute of Science and Technology (<a href="http://nist.gov/">NIST</a>) is leading the charge in ensuring safe and trustworthy AI.</p><p>In the AI regulation race, new developments are occurring daily. On April 29th, 2024, NIST released four AI <a href="https://www.dataguidance.com/news/usa-nist-publishes-draft-documents-ai?mkt_tok=MTEzLVpZRC0zODkAAAGSzkysRmWDuAsvXNmVt3kBE_JdjCBN4beyBMJnkoWIM_ffHzA5lFVBiXFqQIXAJ8-2dQfeyVr2ljinN6VbzTOvRbabkKOQ2KwhP_DAd7pfhA">documents,</a> 180 following a US executive order on safe AI development. These documents help developers manage risks in AI, secure software development, and address issues with synthetic content. They’re also working on global AI standards. This blog dives into the ongoing effort to regulate AI.</p><h3>NIST AI Resource Roadmap</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*h-ins9df5u6O2L7LZLxqxw.png" /><figcaption>This diagram from the NIST AI resource center <a href="https://airc.nist.gov/">website</a> outlines a roadmap for improving the AI Risk Management Framework (AI RMF). This roadmap suggests ways for NIST and other organizations (public or private) to collaborate and develop the AI RMF further. The focus is on filling knowledge gaps and creating best practices for trustworthy AI. As AI technology advances, the roadmap itself will adapt.</figcaption></figure><p>Among these efforts is the <a href="https://www.nist.gov/artificial-intelligence/artificial-intelligence-safety-institute">Artificial Intelligence Safety Institute Consortium</a> (AISIC). As written in the Consortium agreement, the purpose is to “. . . establish a <strong>new measurement science</strong> that will enable the identification of proven, scalable, and interoperable measurements and methodologies to promote <strong>safe and trustworthy</strong> development and use of Artificial Intelligence (AI), particularly for the most advanced AI.”</p><p>This article discusses the Consortium, as well as the<a href="https://www.whitehouse.gov/ostp/ai-bill-of-rights/"> Blueprint for an AI Bill of Rights</a>. We’ll focus on the US approach to AI regulation, but also include the EU and China for a reason: these three regions are major players in the development and regulation of AI. Their approaches can inform each other and the broader global conversation around AI governance.</p><ul><li>The US is a leader in AI research and development, and its regulatory decisions will have a significant impact on the global AI landscape.</li><li>The EU has taken a proactive approach to AI regulation, with the GDPR being a prime example. Their approach emphasizes ethics and data privacy.</li><li>China is another major player in AI development, and its approach to regulation is likely to be shaped by its unique political and economic context.</li></ul><p>By comparing the approaches of these three regions, the article can provide a more comprehensive picture of AI governance on the global scale.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Iq0y8Gka0z69OQIvazggw.png" /></figure><p>This timeline gives a few of the highlights from the major world actors in AI regulation, starting with the General Data Protection Regulation (<a href="https://gdpr-info.eu/">GDPR</a>) in the EU in 2018. The GDPR is a European law that gives people in the EU control over their personal information. It requires companies to be transparent about how they use data and gives individuals rights to access, correct, or erase their data. The GDPR influenced regulations on data protection throughout the world, and a similar trend is anticipated with AI regulation.</p><p>The prevailing approach to AI governance around the world has been to establish national strategies or ethics policies before enacting legislation. This has absolutely been true in the United States.</p><p>In 2020, the US <a href="https://www.congress.gov/bill/116th-congress/house-bill/6216">National AI Initiative Act</a> was introduced. The National Artificial Intelligence Initiative Act of 2020 created a national program to advance AI research, education, and development. It established various committees and offices to oversee the initiative, conducted research on AI’s impact, and developed standards for AI systems.</p><p>Concerns about responsible AI development gained momentum in 2021 with <a href="https://www.holisticai.com/blog/china-ai-regulation">China</a> and the <a href="https://artificialintelligenceact.eu/">EU</a> proposing regulations.</p><p>On April 21st, 2021, the European Commission, which is the governing body of the European Union (EU), released a proposal for a new law. This law aimed to regulate the development and use of artificial intelligence (AI) technologies within the EU. The purpose of this proposal was to make sure AI is used safely and ethically throughout the European Union.</p><p>In September 2021 a Chinese government committee issued “Ethical Norms for New Generation Artificial Intelligence.” These norms aimed to establish ethical guidelines for using AI in China. They addressed data privacy, human control over AI systems, and preventing monopolies in the AI sector. However, the document lacked specifics on enforcement mechanisms and penalties for non-compliance.</p><p>In October 2022 in the US, the White House released the Blueprint for an AI Bill of Rights, discussed in more detail below. In early 2023, we saw further development with <a href="https://www.loc.gov/item/global-legal-monitor/2023-04-25/china-provisions-on-deep-synthesis-technology-enter-into-effect/">China’s Deep Synthesis Provisions</a>, aiming to control deepfakes. This will drastically alter how AI creates content for its massive 1.4 billion population due to the law’s wide-reaching impact.</p><p>2023 also brought President Biden’s <a href="https://www.whitehouse.gov/briefing-room/presidential-actions/2023/10/30/executive-order-on-the-safe-secure-and-trustworthy-development-and-use-of-artificial-intelligence/">Executive Order</a> on the Safe, Secure, and Trustworthy Development and Use of AI. This new government rule aims to make sure AI is developed and used safely and securely. It also protects people’s privacy, fights discrimination, and helps both businesses and workers. The rule encourages innovation and competition in the US, making it a leader in AI technology.</p><p>Most recently, in February 2024, the European Union solidified its commitment with the launch of a dedicated AI office. The EU has taken massive strides with the EU AI Act. The EU AI Act is the world’s first major law regulating AI. It classifies AI applications into<strong> risk categories</strong>: high-risk applications (like job applicant ranking tools) face strict rules, while minimal-risk uses (like video games) are unregulated. The Act aims to ensure safe and ethical development of AI in the EU.</p><p>The US has aligned with the EU on this, and new developments are occurring daily as the race to AI regulation trudges on. Now that we have seen a brief history of the last few years of notable AI regulations, let’s look at one example of recommendations from the US Blueprint for an AI Bill of Rights.</p><h3>The Blueprint for an AI Bill of Rights</h3><p>Setting the tone for the NIST working grounds, we can take a look at the AI Bill of Rights as a blueprint for current and future efforts. As you review this section, think about how the principles could be turned into laws and regulations, and how this will function in practice.</p><p>There are many examples of advancements in technology and data collection which are threatening <a href="https://www.whitehouse.gov/ostp/ai-bill-of-rights/">fairness and fundamental rights</a>, including unequal loan algorithms, unsafe medical AI, and unchecked social media data collection, not to mention AI’s threat to democracy.</p><p>While beneficial, AI tools restrict access to resources, perpetuate bias, and violate privacy. The<a href="https://www.whitehouse.gov/ostp/ai-bill-of-rights/"> AI Bill of Rights</a> outlines principles to safeguard people from harmful AI and promote its ethical use. This framework, informed by public experiences and expert input, offers a guide for policymakers and developers to ensure AI protects our rights and values.</p><p>Here are the five principles of the AI Bill of Rights:</p><h4>Safe and Effective Systems</h4><p>The AI Bill of Rights aims to protect you from unsafe AI and biased data use. Developers should involve experts and the public to identify risks and ensure AI is designed and tested to be safe, effective, and fair.</p><h4>Algorithmic Discrimination Protections</h4><p>The AI Bill of Rights fights against algorithmic discrimination. It ensures AI is designed and tested to be fair and unbiased, protecting people from unfair treatment based on various characteristics.</p><h4>Data Privacy</h4><p>The AI Bill of Rights protects your data privacy. It gives you control over how your data is collected and used, and restricts its use in sensitive areas like health and finance. You should also be free from excessive surveillance.</p><h4>Notice and Explanation</h4><p>The AI Bill of Rights ensures transparency in AI use. You deserve to know when an automated system is making decisions that affect you, and how it arrives at those choices.</p><h4>Human Alternatives, Consideration, and Fallback</h4><p>You should have control over your AI interactions. You should be able to opt-out of AI systems and have access to a human when you run into problems and in sensitive domains like criminal justice, health, employment, and education.</p><p>Overall, the AI Bill of Rights serves as a critical framework for ensuring the responsible development and deployment of automated systems. By outlining core principles like fairness, transparency, and accountability, it aims to safeguard individuals and communities from potential harms associated with AI. This framework fosters a future where AI strengthens democratic values by promoting equal opportunity, protecting civil liberties, and ensuring access to essential resources. The AI Bill of Rights empowers us to harness the power of AI innovation while safeguarding the fundamental rights that underpin a just and thriving society. How do we address the vast gap between intangible statements of intent and tangible, enforceable legislation? That is where the AISIC comes in.</p><p>In a February 7th, 2024 <a href="https://www.nist.gov/news-events/news/2024/04/us-commerce-secretary-gina-raimondo-announces-expansion-us-ai-safety">announcement</a>, the U.S. Secretary of Commerce, Gina Raimondo, unveiled the leadership team responsible for guiding the forthcoming U.S. AI Safety Institute (USAISI) housed within the NIST. This is following the AI Bill of Rights and President Biden’s <a href="https://www.whitehouse.gov/briefing-room/presidential-actions/2023/10/30/executive-order-on-the-safe-secure-and-trustworthy-development-and-use-of-artificial-intelligence/">executive order</a> on the safe, secure, and trustworthy development and use of AI.</p><h3>The Artificial Intelligence Safety Institute Consortium (AISIC)</h3><p>The US Artificial Intelligence Safety Institute (USAISI) is part of the National Institute of Standards and Technology (NIST). It’s tasked with creating instructions, testing AI systems, and researching how to achieve the goals outlined in President Biden’s Executive Order on AI. The AISIC initiative, spearheaded by the NIST, seeks to foster the development and deployment of trustworthy and safe AI. The U.S. AI Safety Institute Consortium (AISIC) will convene a broad range of participants, encompassing AI developers and users, academic researchers, government and industry representatives, and civil society organizations.</p><p>The AISIC is leading the charge for secure AI development. I’m fortunate to work on this critical issue at Accel AI Institute, a member of the consortium.</p><blockquote>Accel AI Institute contributes to the Consortium’s efforts along with over two hundred stakeholders through strategic advice, resource sharing, and consulting on ethical AI development for all members. Our focus areas include bias mitigation, explainable AI, and ethical development practices. Additionally, Accel AI Institute’s LatinX in AI initiative promotes diversity and inclusion within the field of AI.</blockquote><p>This Consortium will leverage the expertise of leading corporations and innovative startups alongside academic and civil society thought leaders who are shaping our understanding of AI’s societal impact. Membership includes the nation’s largest enterprises, cutting-edge AI system and hardware creators, key figures from academia and the general public, and representatives from professions heavily reliant on AI.</p><p>Additionally, state and local governments, along with non-profit organizations such as Accel AI are part of this collaborative effort. The consortium’s focus extends beyond the United States, aiming to collaborate with international organizations to establish interoperable and effective safety standards for AI on a global scale.</p><p>Within the AISIC are several working groups, which can shift and develop as collaboration ensues. The working groups include the following: Risk Management for Generative AI, Synthetic Content, Capability Evaluations, Red-Teaming, and Safety &amp; Security. These working groups have now been broken down into task force teams to complete the research and development that has been identified.</p><p>Although I cannot yet share specifics on research and implementation from these working groups until we publish our findings, I can provide some basic definitions of what the working groups are covering:</p><p><strong>Generative AI </strong>can create incredibly realistic and believable content, but this poses risks. Malicious actors can use it to spread misinformation, create deepfakes to damage reputations, or generate biased content that amplifies societal inequalities. Even with good intentions, generated content can be unintentionally biased or misleading, reflecting the data used to train the AI. This can perpetuate societal inequalities or simply create confusion due to the difficulty of distinguishing real from artificial content.</p><p><strong>Synthetic content </strong>in AI refers to computer-generated data that mimics real-world content. This can include realistic-looking images, videos, or even text that’s indistinguishable from human-created content. It’s often used for training AI models, but also raises concerns about deepfakes, misinformation, and potential copyright issues. Synthetic content is another way of explaining misinformation, and what is called hallucination or fabrication. Misinformation can have huge consequences, such as swaying elections. This is especially important as billions of people are going to the polls this year.</p><p><strong>Capability evaluations</strong> of AI test how well a system performs its tasks, assessing accuracy, robustness, fairness, and explainability to ensure its reliability and trustworthiness. Imagine a company developing an AI loan system. To ensure a trustworthy system, they test it beyond just accuracy. They see if it treats everyone fairly regardless of background, can handle unusual finances, and explains its loan decisions clearly. This helps reduce bias and promotes fair lending practices.</p><p><strong>Red-teaming</strong> for AI involves simulating attacks on AI models to identify vulnerabilities and weaknesses, aiming to improve their safety and prevent them from being misused. Imagine researchers are developing a powerful generative AI that can write different creative text formats, like poems or news articles. To test its security, they might “red team” it by feeding the AI prompts designed to generate harmful content. For example, they might see if the AI can be tricked into writing hateful slogans or create fake news articles that are incredibly convincing but completely untrue. By identifying these vulnerabilities, the researchers can improve the safeguards in the gen-AI and prevent it from being misused to generate malicious content.</p><p><strong>Safety and Security </strong>can be defined separately:</p><ul><li><strong>Safety:</strong> <a href="https://csrc.nist.gov/glossary/term/safety">Defined</a> by NIST is “freedom from conditions that can cause death, injury, occupational illness, damage to or loss of equipment or property, or damage to the environment”</li><li><strong>Security:</strong> Focused on information systems and data, NIST’s Computer Security Resource Center glossary <a href="https://csrc.nist.gov/glossary/term/security">defines it as</a> “the protection of information systems from unauthorized access, use, disclosure, disruption, modification, or destruction”.</li></ul><p>NIST’s AI Safety Institute, which is supported by the AISIC, has three main goals:</p><ol><li><strong>Collaboration</strong>: Establish a long-term, open consortium where researchers, industry, and the public can work together on trustworthy AI measurement science.</li><li><strong>Industry Standards</strong>: Develop tools and best practices to help industries create safe, secure, and reliable AI systems.</li><li><strong>Risk Assessment</strong>: Create methods for identifying and evaluating potential harms caused by AI systems.</li></ol><p>This is all in an effort to “. . . ready the U.S. to address the capabilities of the next generation of AI models or systems, from frontier models to new applications and approaches, with appropriate risk management strategies.”(<a href="https://www.nist.gov/artificial-intelligence/artificial-intelligence-safety-institute">NIST, 2024</a>)</p><p>All in all, the Consortium is an important and necessary step in steering a good path forward for AI oversight. However, I anticipate a lot of challenges and needs that we cannot yet anticipate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jieiu7r3GnIW2xOSKhMULg.jpeg" /><figcaption>This image was generated by <a href="https://runwayml.com/ai-tools/text-to-image/">https://runwayml.com/ai-tools/text-to-image/</a> with a prompt to make an image of a futuristic train with unfinished tracks.</figcaption></figure><p>Imagine AI as a high-speed train with the potential to revolutionize transportation (solving complex problems, improving efficiency). However, unlike established railways, the tracks for AI are still under construction (AI is a developing field). Unforeseen obstacles (ethical issues, technical limitations) could derail the train (cause serious problems) despite good intentions. The responsibility lies with the engineers (developers, ethicists, policy makers) to carefully lay the tracks, ensuring they are safe, well-maintained, and lead to the desired destination (ethical and beneficial applications).</p><h3>Conclusion: Balancing Progress and Responsibility with AI</h3><p>While AI offers immense potential to revolutionize various aspects of our lives, navigating its development requires careful consideration. Like a high-speed train on incomplete tracks, AI is venturing into uncharted territory. The decisions and recommendations made by those working within the AISIC and others are crucial for laying a safe and ethical foundation for this powerful technology.</p><p>Implementing these recommendations on a global scale presents a challenge. AI’s rapid growth and global reach make regulation and monitoring complex. Here, fostering international collaboration and knowledge sharing becomes essential.</p><p>Furthermore, true “safe” and “trustworthy” AI goes beyond technical considerations. We must address the ethical implications — from data bias and neocolonial appropriation to environmental concerns related to data centers. Focusing solely on Hollywood-style AI threats overshadows the more insidious issues of social inequities and power imbalances that AI can perpetuate.</p><p>The path forward lies in prioritizing human well-being and environmental sustainability. Initiatives like the AI Bill of Rights and the AISIC offer a valuable framework for developing AI guided by ethics and human values. By holding developers and regulators accountable and amplifying the voices of those advocating for people and the planet, we can ensure that AI fulfills its potential for positive change.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzUKRmfeVXnc%3Fstart%3D85%26feature%3Doembed%26start%3D85&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzUKRmfeVXnc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzUKRmfeVXnc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb8db99298553fea4179e3f2857331cd/href">https://medium.com/media/fb8db99298553fea4179e3f2857331cd/href</a></iframe><p>You can stay up to date with <a href="http://www.accel.ai/">Accel.AI</a>; workshops, research, and social impact initiatives through our <a href="https://www.aacel.ai/">website</a>, <a href="http://eepurl.com/cDKkkH">mailing list</a>, <a href="https://www.meetup.com/Artificial-Intelligence-Deep-Learning-Enthusiasts-Meetup/">meetup group</a>, <a href="https://twitter.com/AccelerateAI">Twitter</a>, and <a href="https://www.facebook.com/accelai/">Facebook</a>.</p><h3>Join us in driving #AI for #SocialImpact initiatives around the world!</h3><h3>If you enjoyed reading this, you could contribute good vibes (and help more people discover this post and our community) by hitting the 👏 below — it means a lot!</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a4a9fda6eec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/accel-ai/the-ai-regulation-race-4a4a9fda6eec">The AI Regulation Race</a> was originally published in <a href="https://medium.com/accel-ai">Accel.AI</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>