<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alvaro S. Marcus on Medium]]></title>
        <description><![CDATA[Stories by Alvaro S. Marcus on Medium]]></description>
        <link>https://medium.com/@alvaro.marcus?source=rss-72eeebb8425d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*b9pUTinA6FJ2_fdXYhy_Yg.png</url>
            <title>Stories by Alvaro S. Marcus on Medium</title>
            <link>https://medium.com/@alvaro.marcus?source=rss-72eeebb8425d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 10:12:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alvaro.marcus/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Comunicação Bidirecional entre STM32 e Python via USB CDC]]></title>
            <link>https://medium.com/@alvaro.marcus/comunica%C3%A7%C3%A3o-bidirecional-entre-stm32-e-python-via-usb-cdc-60d8c3ba41f0?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/60d8c3ba41f0</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[embedded]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[stm32]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Thu, 20 Feb 2025 13:13:48 GMT</pubDate>
            <atom:updated>2025-02-20T13:16:18.416Z</atom:updated>
            <content:encoded><![CDATA[<p>Este projeto implementa uma comunicação bidirecional entre um microcontrolador STM32 e um PC, utilizando a interface USB CDC. O firmware desenvolvido para o STM32, por meio do STM32CubeIDE, envia periodicamente uma mensagem que pode ser alterada dinamicamente quando o dispositivo recebe dados via USB. No lado do PC, um script Python utiliza a biblioteca <strong>pyserial</strong> para enviar comandos e receber dados, permitindo o controle remoto do microcontrolador.</p><p><strong>Vídeo de Demonstração:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-Mo-MJBEMHk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-Mo-MJBEMHk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-Mo-MJBEMHk%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e342edc10be85e000117efd34675287e/href">https://medium.com/media/e342edc10be85e000117efd34675287e/href</a></iframe><p><strong>Visão Geral do Projeto</strong></p><p><strong>Objetivos</strong></p><ul><li><strong>Estabelecer uma comunicação bidirecional:</strong> O STM32 envia mensagens periodicamente via USB CDC e, ao receber dados, atualiza a mensagem transmitida.</li><li><strong>Implementar uma interface simples em Python:</strong> Um script Python, utilizando threads, permite o envio e a recepção de mensagens simultaneamente.</li></ul><p><strong>Ferramentas e Tecnologias Utilizadas</strong></p><ul><li><strong>STM32CubeIDE:</strong> Ambiente de desenvolvimento para o firmware do STM32.</li><li><strong>USB CDC (Communication Device Class):</strong> Classe USB utilizada para simular uma porta serial virtual.</li><li><strong>pyserial:</strong> Biblioteca Python para comunicação serial.</li><li><strong>Python (3.11):</strong> Linguagem utilizada para implementar a interface no PC.</li></ul><p><strong>Detalhes Técnicos</strong></p><p><strong>Firmware no STM32</strong></p><p><strong>main.c</strong></p><p>No arquivo main.c, um buffer global denominado msg_buffer é utilizado para armazenar a mensagem que será transmitida via USB. O fluxo de execução é o seguinte:</p><ol><li><strong>Inicialização:</strong></li></ol><ul><li>O sistema e os periféricos são inicializados (incluindo o clock e a interface USB).</li><li>Após um breve delay para estabilização, o buffer msg_buffer é inicializado com a mensagem “starting\n” e enviada uma vez.</li></ul><ol><li><strong>Loop Principal:</strong></li></ol><ul><li>O buffer é redefinido para “running\n”.</li><li>Em um loop infinito, a função CDC_Transmit_FS envia periodicamente (a cada 1 segundo) o conteúdo de msg_buffer.</li></ul><ol><li><strong>Atualização do Buffer via USB:</strong></li></ol><ul><li>Quando o STM32 recebe dados pela USB, o callback CDC_Receive_FS (modificado no arquivo usbd_cdc_if.c) copia os dados recebidos para msg_buffer, alterando a mensagem que será enviada nas próximas iterações.</li></ul><p>O código completo do main.c é apresentado abaixo:</p><pre>/* USER CODE BEGIN Header */<br>/**<br>******************************************************************************<br>* @file : main.c<br>* @brief : Main program body with bidirectional communication<br>******************************************************************************<br>* @attention<br>*<br>* Copyright © 2024 STMicroelectronics.<br>* All rights reserved.<br>*<br>* This software is licensed under terms that can be found in the LICENSE file<br>* in the root directory of this software component.<br>* If no LICENSE file comes with this software, it is provided AS-IS.<br>*<br>******************************************************************************<br>*/<br>/* USER CODE END Header */<br>/* Includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br>#include &quot;main.h&quot;<br>#include &quot;usb_device.h&quot;<br>/* Private includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br>/* USER CODE BEGIN Includes */<br>#include &quot;string.h&quot;<br>#include &quot;usbd_cdc_if.h&quot;<br>/* USER CODE END Includes */<br>/* Private typedef - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/* USER CODE BEGIN PTD */<br>/* USER CODE END PTD */<br>/* Private define - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br>/* USER CODE BEGIN PD */<br>/* USER CODE END PD */<br>/* Private macro - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/* USER CODE BEGIN PM */<br>/* USER CODE END PM */<br>/* Private variables - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/* USER CODE BEGIN PV */<br>/* USER CODE END PV */<br>/* Private function prototypes - - - - - - - - - - - - - - - - - - - - - - - -*/<br>void SystemClock_Config(void);<br>static void MX_GPIO_Init(void);<br>/* USER CODE BEGIN PFP */<br>/* USER CODE END PFP */<br>/* Private user code - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/* USER CODE BEGIN 0 */<br>/* Buffer global para a mensagem que será transmitida.<br>Quando o STM32 receber dados via USB CDC, esse buffer será atualizado. */<br>uint8_t msg_buffer[64];<br>/* USER CODE END 0 */<br>/**<br>* @brief The application entry point.<br>* @retval int<br>*/<br>int main(void)<br>{<br>/* USER CODE BEGIN 1 */<br>/* USER CODE END 1 */<br>/* MCU Configuration - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br>/* Reset of all peripherals, Initializes the Flash interface and the Systick. */<br>HAL_Init();<br>/* USER CODE BEGIN Init */<br>/* USER CODE END Init */<br>/* Configure the system clock */<br>SystemClock_Config();<br>/* USER CODE BEGIN SysInit */<br>/* USER CODE END SysInit */<br>/* Initialize all configured peripherals */<br>MX_GPIO_Init();<br>MX_USB_DEVICE_Init();<br>/* USER CODE BEGIN 2 */<br>HAL_Delay(5000);<br>/* Inicializa msg_buffer com a mensagem inicial e envia uma vez */<br>strcpy((char*)msg_buffer, &quot;starting\n&quot;);<br>CDC_Transmit_FS(msg_buffer, strlen((char*)msg_buffer));<br>HAL_Delay(2000);<br>/* Define a mensagem padrão para o loop; ela poderá ser alterada via USB CDC */<br>strcpy((char*)msg_buffer, &quot;running\n&quot;);<br>/* USER CODE END 2 */<br>/* Infinite loop */<br>/* USER CODE BEGIN WHILE */<br>while (1)<br>{<br>CDC_Transmit_FS(msg_buffer, strlen((char*)msg_buffer));<br>HAL_Delay(1000);<br>}<br>/* USER CODE END WHILE */<br>/* USER CODE BEGIN 3 */<br>/* USER CODE END 3 */<br>}<br>/**<br>* @brief System Clock Configuration<br>* @retval None<br>*/<br>void SystemClock_Config(void)<br>{<br>RCC_OscInitTypeDef RCC_OscInitStruct = {0};<br>RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};<br>RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};<br>/** Initializes the RCC Oscillators according to the specified parameters<br>* in the RCC_OscInitTypeDef structure.<br>*/<br>RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;<br>RCC_OscInitStruct.HSEState = RCC_HSE_ON;<br>RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;<br>RCC_OscInitStruct.HSIState = RCC_HSI_ON;<br>RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;<br>RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;<br>RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6;<br>if (HAL_RCC_OscConfig(&amp;RCC_OscInitStruct) != HAL_OK)<br>{<br>Error_Handler();<br>}<br>/** Initializes the CPU, AHB and APB buses clocks<br>*/<br>RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK<br>|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;<br>RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;<br>RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;<br>RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;<br>RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;<br>if (HAL_RCC_ClockConfig(&amp;RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK)<br>{<br>Error_Handler();<br>}<br>PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB;<br>PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL;<br>if (HAL_RCCEx_PeriphCLKConfig(&amp;PeriphClkInit) != HAL_OK)<br>{<br>Error_Handler();<br>}<br>}<br>/**<br>* @brief GPIO Initialization Function<br>* @param None<br>* @retval None<br>*/<br>static void MX_GPIO_Init(void)<br>{<br>/* USER CODE BEGIN MX_GPIO_Init_1 */<br>/* USER CODE END MX_GPIO_Init_1 */<br>/* GPIO Ports Clock Enable */<br>__HAL_RCC_GPIOD_CLK_ENABLE();<br>__HAL_RCC_GPIOA_CLK_ENABLE();<br>/* USER CODE BEGIN MX_GPIO_Init_2 */<br>/* USER CODE END MX_GPIO_Init_2 */<br>}<br>/**<br>* @brief This function is executed in case of error occurrence.<br>* @retval None<br>*/<br>void Error_Handler(void)<br>{<br>/* USER CODE BEGIN Error_Handler_Debug */<br>__disable_irq();<br>while (1)<br>{<br>}<br>/* USER CODE END Error_Handler_Debug */<br>}<br>#ifdef USE_FULL_ASSERT<br>/**<br>* @brief Reports the name of the source file and the source line number<br>* where the assert_param error has occurred.<br>* @param file: pointer to the source file name<br>* @param line: assert_param error line source number<br>* @retval None<br>*/<br>void assert_failed(uint8_t *file, uint32_t line)<br>{<br>/* USER CODE BEGIN 6 */<br>/* User can add his own implementation to report the file name and line number,<br>ex: printf(&quot;Wrong parameters value: file %s on line %d\r\n&quot;, file, line) */<br>/* USER CODE END 6 */<br>}<br>#endif /* USE_FULL_ASSERT */</pre><p><strong>usbd_cdc_if.c</strong></p><p>No arquivo usbd_cdc_if.c, a função CDC_Receive_FS foi modificada para que, ao receber dados pela USB, estes sejam copiados para o buffer global msg_buffer definido em main.c. Essa alteração garante que a mensagem transmitida seja atualizada dinamicamente com o novo conteúdo enviado pelo PC.</p><p>Segue o código:</p><pre>/* USER CODE BEGIN Header */<br>/**<br>******************************************************************************<br>* @file : usbd_cdc_if.c<br>* @version : v2.0_Cube<br>* @brief : Usb device for Virtual Com Port.<br>******************************************************************************<br>* @attention<br>*<br>* Copyright © 2024 STMicroelectronics.<br>* All rights reserved.<br>*<br>* This software is licensed under terms that can be found in the LICENSE file<br>* in the root directory of this software component.<br>* If no LICENSE file comes with this software, it is provided AS-IS.<br>*<br>******************************************************************************<br>*/<br>/* USER CODE END Header */<br>/* Includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br>#include &quot;usbd_cdc_if.h&quot;<br>/* USER CODE BEGIN INCLUDE */<br>/* USER CODE END INCLUDE */<br>/* Private typedef - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/* Private define - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */<br>/* Private macro - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/* USER CODE BEGIN PV */<br>/* Private variables - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/* USER CODE END PV */<br>/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY<br>* @brief Usb device library.<br>* @{<br>*/<br>/** @addtogroup USBD_CDC_IF<br>* @{<br>*/<br>/** @defgroup USBD_CDC_IF_Private_TypesDefinitions USBD_CDC_IF_Private_TypesDefinitions<br>* @brief Private types.<br>* @{<br>*/<br>/* USER CODE BEGIN PRIVATE_TYPES */<br>/* USER CODE END PRIVATE_TYPES */<br>/**<br>* @}<br>*/<br>/** @defgroup USBD_CDC_IF_Private_Defines USBD_CDC_IF_Private_Defines<br>* @brief Private defines.<br>* @{<br>*/<br>/* USER CODE BEGIN PRIVATE_DEFINES */<br>/* USER CODE END PRIVATE_DEFINES */<br>/**<br>* @}<br>*/<br>/** @defgroup USBD_CDC_IF_Private_Macros USBD_CDC_IF_Private_Macros<br>* @brief Private macros.<br>* @{<br>*/<br>/* USER CODE BEGIN PRIVATE_MACRO */<br>/* USER CODE END PRIVATE_MACRO */<br>/**<br>* @}<br>*/<br>/** @defgroup USBD_CDC_IF_Private_Variables USBD_CDC_IF_Private_Variables<br>* @brief Private variables.<br>* @{<br>*/<br>/* Create buffer for reception and transmission */<br>/* It&#39;s up to user to redefine and/or remove those define */<br>/** Received data over USB are stored in this buffer */<br>uint8_t UserRxBufferFS[APP_RX_DATA_SIZE];<br>/** Data to send over USB CDC are stored in this buffer */<br>uint8_t UserTxBufferFS[APP_TX_DATA_SIZE];<br>/* USER CODE BEGIN PRIVATE_VARIABLES */<br>/* USER CODE END PRIVATE_VARIABLES */<br>/**<br>* @}<br>*/<br>/** @defgroup USBD_CDC_IF_Exported_Variables USBD_CDC_IF_Exported_Variables<br>* @brief Public variables.<br>* @{<br>*/<br>extern USBD_HandleTypeDef hUsbDeviceFS;<br>/* USER CODE BEGIN EXPORTED_VARIABLES */<br>/* USER CODE END EXPORTED_VARIABLES */<br>/**<br>* @}<br>*/<br>/** @defgroup USBD_CDC_IF_Private_FunctionPrototypes USBD_CDC_IF_Private_FunctionPrototypes<br>* @brief Private functions declaration.<br>* @{<br>*/<br>static int8_t CDC_Init_FS(void);<br>static int8_t CDC_DeInit_FS(void);<br>static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length);<br>static int8_t CDC_Receive_FS(uint8_t* pbuf, uint32_t *Len);<br>/* USER CODE BEGIN PRIVATE_FUNCTIONS_DECLARATION */<br>/* USER CODE END PRIVATE_FUNCTIONS_DECLARATION */<br>/**<br>* @}<br>*/<br>USBD_CDC_ItfTypeDef USBD_Interface_fops_FS =<br>{<br>CDC_Init_FS,<br>CDC_DeInit_FS,<br>CDC_Control_FS,<br>CDC_Receive_FS<br>};<br>/* Private functions - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/<br>/**<br>* @brief Initializes the CDC media low layer over the FS USB IP<br>* @retval USBD_OK if all operations are OK else USBD_FAIL<br>*/<br>static int8_t CDC_Init_FS(void)<br>{<br>/* USER CODE BEGIN 3 */<br>/* Set Application Buffers */<br>USBD_CDC_SetTxBuffer(&amp;hUsbDeviceFS, UserTxBufferFS, 0);<br>USBD_CDC_SetRxBuffer(&amp;hUsbDeviceFS, UserRxBufferFS);<br>return (USBD_OK);<br>/* USER CODE END 3 */<br>}<br>/**<br>* @brief DeInitializes the CDC media low layer<br>* @retval USBD_OK if all operations are OK else USBD_FAIL<br>*/<br>static int8_t CDC_DeInit_FS(void)<br>{<br>/* USER CODE BEGIN 4 */<br>return (USBD_OK);<br>/* USER CODE END 4 */<br>}<br>/**<br>* @brief Manage the CDC class requests<br>* @param cmd: Command code<br>* @param pbuf: Buffer containing command data (request parameters)<br>* @param length: Number of data to be sent (in bytes)<br>* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL<br>*/<br>static int8_t CDC_Control_FS(uint8_t cmd, uint8_t* pbuf, uint16_t length)<br>{<br>/* USER CODE BEGIN 5 */<br>switch(cmd)<br>{<br>case CDC_SEND_ENCAPSULATED_COMMAND:<br>break;<br>case CDC_GET_ENCAPSULATED_RESPONSE:<br>break;<br>case CDC_SET_COMM_FEATURE:<br>break;<br>case CDC_GET_COMM_FEATURE:<br>break;<br>case CDC_CLEAR_COMM_FEATURE:<br>break;<br>case CDC_SET_LINE_CODING:<br>break;<br>case CDC_GET_LINE_CODING:<br>break;<br>case CDC_SET_CONTROL_LINE_STATE:<br>break;<br>case CDC_SEND_BREAK:<br>break;<br>default:<br>break;<br>}<br>return (USBD_OK);<br>/* USER CODE END 5 */<br>}<br>/**<br>* @brief Data received over USB OUT endpoint are sent over CDC interface<br>* through this function.<br>* @param Buf: Buffer of data to be received<br>* @param Len: Number of data received (in bytes)<br>* @retval Result of the operation: USBD_OK if all operations are OK else USBD_FAIL<br>*/<br>static int8_t CDC_Receive_FS(uint8_t* Buf, uint32_t *Len)<br>{<br>/* USER CODE BEGIN 6 */<br>/* Declara o buffer global definido em main.c */<br>extern uint8_t msg_buffer[64];<br>/* Copia os dados recebidos para msg_buffer de forma segura */<br>uint32_t copy_len = (*Len &lt; (sizeof(msg_buffer) - 1)) ? *Len : (sizeof(msg_buffer) - 1);<br>memcpy(msg_buffer, Buf, copy_len);<br>msg_buffer[copy_len] = &#39;\0&#39;; // Garante a terminação nula<br>/* Prepara para receber o próximo pacote */<br>USBD_CDC_SetRxBuffer(&amp;hUsbDeviceFS, UserRxBufferFS);<br>USBD_CDC_ReceivePacket(&amp;hUsbDeviceFS);<br>return (USBD_OK);<br>/* USER CODE END 6 */<br>}<br>/**<br>* @brief CDC_Transmit_FS<br>* Data to send over USB IN endpoint are sent over CDC interface<br>* through this function.<br>* @param Buf: Buffer of data to be sent<br>* @param Len: Number of data to be sent (in bytes)<br>* @retval USBD_OK if all operations are OK else USBD_FAIL or USBD_BUSY<br>*/<br>uint8_t CDC_Transmit_FS(uint8_t* Buf, uint16_t Len)<br>{<br>uint8_t result = USBD_OK;<br>/* USER CODE BEGIN 7 */<br>USBD_CDC_HandleTypeDef *hcdc = (USBD_CDC_HandleTypeDef*)hUsbDeviceFS.pClassData;<br>if (hcdc-&gt;TxState != 0)<br>{<br>return USBD_BUSY;<br>}<br>USBD_CDC_SetTxBuffer(&amp;hUsbDeviceFS, Buf, Len);<br>result = USBD_CDC_TransmitPacket(&amp;hUsbDeviceFS);<br>/* USER CODE END 7 */<br>return result;<br>}<br>/* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */<br>/* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */<br>/**<br>* @}<br>*/<br>/**<br>* @}<br>*/</pre><p><strong>Script Python para Comunicação Bidirecional</strong></p><p>O script Python utiliza a biblioteca <strong>pyserial</strong> para estabelecer a comunicação com o STM32. Para que as operações de leitura e escrita ocorram simultaneamente, são utilizadas threads, permitindo que o usuário envie mensagens via console enquanto os dados recebidos são exibidos na tela.</p><p><strong>Funcionamento do Script</strong></p><ol><li><strong>Leitura Contínua:</strong><br> Uma thread verifica continuamente se há dados disponíveis na porta serial e os imprime.</li><li><strong>Envio de Mensagens:</strong><br> Outra thread aguarda a entrada do usuário e envia a mensagem para o STM32.</li><li><strong>Comunicação Bidirecional:</strong><br> Ambas as operações ocorrem de forma paralela, possibilitando uma comunicação completa sem bloqueios.</li></ol><p>O código do script está apresentado abaixo:</p><p><strong>Instale o PySerial:</strong><br> Abra o terminal (ou use o terminal integrado do VSCode) e execute:</p><pre>pip install pyserial</pre><p>Crie um arquivo, por exemplo serial_write and read.py, e insira o código a seguir:</p><pre>import serial<br>import time<br>import threading<br><br>def read_from_port(ser):<br>    &quot;&quot;&quot;Thread para leitura contínua dos dados recebidos.&quot;&quot;&quot;<br>    while True:<br>        if ser.in_waiting:<br>            try:<br>                data = ser.read(ser.in_waiting).decode(&#39;utf-8&#39;, errors=&#39;ignore&#39;)<br>                print(&quot;Recebido:&quot;, data)<br>            except Exception as e:<br>                print(&quot;Erro ao ler:&quot;, e)<br>        time.sleep(0.1)<br><br>def write_to_port(ser):<br>    &quot;&quot;&quot;Thread para envio de mensagens digitadas pelo usuário.&quot;&quot;&quot;<br>    while True:<br>        try:<br>            msg = input(&quot;Digite a mensagem para enviar: &quot;)<br>            if msg:<br>                ser.write(msg.encode(&#39;utf-8&#39;))<br>        except Exception as e:<br>            print(&quot;Erro ao enviar:&quot;, e)<br>            break<br><br>def main():<br>    # Configure a porta serial conforme necessário.<br>    ser = serial.Serial(<br>        port=&#39;COM3&#39;,              # Substitua pela porta correta<br>        baudrate=9600,            # Mesmo baud rate configurado no STM32<br>        parity=serial.PARITY_EVEN,  # Paridade par<br>        stopbits=serial.STOPBITS_ONE,<br>        bytesize=serial.EIGHTBITS,  # 8 bits de dados (o nono é a paridade)<br>        timeout=1<br>    )<br><br>    # Aguarda a inicialização da conexão<br>    time.sleep(2)<br>    print(&quot;Iniciando comunicação bidirecional...&quot;)<br><br>    # Cria e inicia as threads de leitura e escrita<br>    thread_leitura = threading.Thread(target=read_from_port, args=(ser,), daemon=True)<br>    thread_escrita = threading.Thread(target=write_to_port, args=(ser,), daemon=True)<br><br>    thread_leitura.start()<br>    thread_escrita.start()<br><br>    try:<br>        while True:<br>            time.sleep(1)  # Mantém o programa ativo<br>    except KeyboardInterrupt:<br>        print(&quot;Encerrando comunicação.&quot;)<br>    finally:<br>        ser.close()<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><p><strong>Conclusão</strong></p><p>Essa abordagem serve como base para diversas aplicações avançadas. Por exemplo, é possível implementar sistemas de controle remoto mais sofisticados, onde o STM32 não apenas transmita e receba mensagens simples, mas também execute comandos complexos, integre sensores e realize processamento em tempo real. Conexão com módulos de comunicação sem fio (Bluetooth, Wi-Fi) para controle remoto de dispositivos, além de sistemas de monitoramento e diagnóstico embarcados que possibilitem a atualização de firmware e a coleta de dados críticos para análise posterior.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60d8c3ba41f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Como Começar a Trabalhar com Visão Computacional: Um Guia Prático]]></title>
            <link>https://medium.com/@alvaro.marcus/como-come%C3%A7ar-a-trabalhar-com-vis%C3%A3o-computacional-um-guia-pr%C3%A1tico-18bdf4f82f5f?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/18bdf4f82f5f</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[visão-computacional]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 03:26:36 GMT</pubDate>
            <atom:updated>2024-07-21T03:26:36.843Z</atom:updated>
            <content:encoded><![CDATA[<p>A visão computacional é um campo fascinante que permite aos computadores interpretar e entender o mundo visual da mesma forma que os humanos. Para aqueles que estão começando nessa área, o primeiro passo pode parecer assustador, mas com as ferramentas e orientações corretas, você pode iniciar sua jornada de maneira eficiente e organizada. Neste artigo, vou guiá-lo pelo processo inicial, desde a configuração do seu ambiente de trabalho até a rotulação de dados, essencial para qualquer projeto de visão computacional.</p><h3>Preparando seu Computador</h3><p>A primeira coisa que você precisa é de um computador com configurações básicas que consiga abrir um navegador e acessar a internet. Isso já é suficiente para começar. Se você pensa que precisa de uma máquina extremamente poderosa para iniciar, não se preocupe. No começo, vamos focar na fase de rotulação dos dados, que é uma tarefa simples e não requer um hardware robusto.</p><p>Como então podemos iniciar de forma simples e barata na visão computacional? Um computador pessoal que consiga abrir um navegador sem problemas e acessar a internet, já é o suficiente. Simples não? <br>Não vamos treinar ou processar a rede neste momento, então os requisitos são simples. Eu priorizo utilizar Linux pois a utilização acaba sendo até mais simples, porém muitos utilizam o Windows e vou descrever o passo a passo para este sistema.</p><h3>Instalando as Ferramentas Necessárias</h3><p>Não estou fazendo propaganda aqui, mas é a aplicação que eu utilizo no dia a dia e atendem muito bem quando é necessário manter a confidencialidade do dataset, estou falando do Makesense.AI, essa aplicação tem a sua versão online e a versão offline, vamos focar na versão offline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MqGU5h9IlMwWRItEzWfFrg.png" /><figcaption><a href="https://www.makesense.ai/">Tela inicial da aplicação</a></figcaption></figure><p>Vamos precisar de alguns softwares para configurar nosso ambiente de trabalho. Abaixo, vou listar e explicar cada um deles:</p><ol><li><a href="https://git-scm.com/download/win"><strong>Git</strong></a>: Sistema de controle de versões que permitirá acessar e clonar repositórios de código.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*hG80mUEDKp100i-YK9yBOw.png" /><figcaption>Acesse a página do Git e procure pelo link conforme imagem acima</figcaption></figure><p>Faça o download e execute o arquivo .exe. A instalação é basicamente clicar em next e aguardar.</p><p><strong>2. </strong><a href="https://www.docker.com/products/docker-desktop/"><strong>Docker Desktop</strong></a>: Criará um ambiente virtual em sua máquina, essencial para rodar a aplicação que utilizaremos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RbEQnwHacvhaBelref1nMQ.png" /><figcaption>Basta clicar em Download for Windows</figcaption></figure><p>Aqui a instalação também é igual a etapa anterior, ao finalizar a instalação abra o docker e deixe-o minimizado.</p><p><strong>3. </strong><a href="https://nodejs.org/en"><strong>Node.js</strong></a>: Inclui o npm, um gerenciador de pacotes que nos ajudará a instalar bibliotecas e dependências necessárias.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qa50r1YZSnL8EECMFE-2bg.png" /><figcaption>Aqui também é simples, escolha por Download Node.js LTS</figcaption></figure><p>Mais uma instalação simples, não é necessário alterar as checkboxes durante o processo de instalação, clique em Next nas janelas e aguarde.</p><h3>Clonando o repositório</h3><p>Agora é basicamente linha de comando. Acesse o menu iniciar e procure pela aplicação “Git CMD” que é o ambiente de comando do Git e onde vamos executar os comando necessários.</p><p>Ao acessar o Git CMD execute o comando:</p><pre>git -v</pre><p>Ele vai retornar a versão do Git instalado na sua máquina indicando êxito na instalação que você realizou:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bMg4oHuD-BjafXaD0ohcLg.png" /><figcaption>Tela do Git CMD</figcaption></figure><p>Se for do seu interesse, você pode navegar pelos diretórios através do Git CMD para definir em qual será armazenado o repositório que será clonado. A partir daí executamos o seguinte comando:</p><pre>git clone https://github.com/SkalskiP/make-sense.git</pre><p>Aguarde o término do processo. E digite:</p><pre>cd make-sense</pre><p>Agora dentro da pasta do make-sense, digite:</p><pre>npm install</pre><p>Aguarde o término do processo e não feche o Git CMD, vamos para a próxima etapa.</p><h3>Configurando o Docker</h3><p>Ainda dentro da pasta make-sense no Git CMD, digite agora o seguinte comando para montar a imagem no Docker:</p><pre># Build Docker Image<br>docker build -t make-sense -f docker/Dockerfile .</pre><p>E agora vamos rodar a imagem como um serviço:</p><pre># Run Docker Image as Service<br>docker run -dit -p 3000:3000 --restart=always --name=make-sense make-sense</pre><p>Após aguardar o processo digite o comando abaixo para ver se ocorreram erros:</p><pre># Get Docker Container Logs<br>docker logs make-sense</pre><h3>Executando</h3><p>Agora terminamos a instalação e configuração, estamos perto de acessar a aplicação. Volte ao Docker Desktop e você vai ver algo como a imagem abaixo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwNPSveWkm58eeR0oDzuFw.png" /><figcaption>Clique em Containers e procure por make-sense</figcaption></figure><p>Após acessar o container “make-sense”, você verá essa tela:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jt8aeL5DAo69YbRh3hoHKA.png" /><figcaption>Clique no link <a href="http://localhost:3000/">http://localhost:3000/</a> do seu container</figcaption></figure><p>Eu recomendo utilizar a versão localhost, pois não será necessário acessar o serviço em ambiente/servidor de terceiro. Quando clicar em localhost, automaticamente a página do make-sense será aberta no seu navegador definido como padrão. Vemos então a tela da aplicação:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAzqJbi4ixsDzmSdDB1Fqw.png" /><figcaption>Acessado via Docker Desktop</figcaption></figure><p>Pronto! Agora estamos prontos para começar os estudos com visão computacional. No próximo artigo vamos aprender como manipular o dataset e rotular as imagens.</p><p>Até a próxima!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18bdf4f82f5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Start Working with Computer Vision: A Practical Guide]]></title>
            <link>https://medium.com/@alvaro.marcus/how-to-start-working-with-computer-vision-a-practical-guide-77c68782851f?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/77c68782851f</guid>
            <category><![CDATA[makesense]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[yolov8]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sun, 21 Jul 2024 03:24:32 GMT</pubDate>
            <atom:updated>2024-07-23T11:31:09.346Z</atom:updated>
            <content:encoded><![CDATA[<p>Computer vision is a fascinating field that allows computers to interpret and understand the visual world in the same way humans do. For those starting in this area, the first step may seem daunting, but with the right tools and guidance, you can begin your journey efficiently and effectively. In this article, I will guide you through the initial process, from setting up your work environment to labeling data, which is essential for any computer vision project.</p><h3>Preparing Your Computer</h3><p>The first thing you need is a computer with basic configurations that can open a browser and access the internet. This is enough to get started. If you think you need an extremely powerful machine to begin, don’t worry. At the start, we will focus on the data labeling phase, which is a simple task and does not require robust hardware.</p><p>How can we then start simply and cheaply in computer vision? A personal computer that can open a browser without problems and access the internet is enough. Simple, right?</p><p>We are not going to train or process the network at this moment, so the requirements are simple. I prioritize using Linux because it is even simpler to use, but many use Windows, and I will describe the step-by-step for this system.</p><h3>Installing the Necessary Tools</h3><p>I’m not promoting here, but this is the application I use daily, and it works very well when it’s necessary to keep the dataset confidential. I’m talking about Makesense.AI. This application has its online and offline versions, and we will focus on the offline version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MqGU5h9IlMwWRItEzWfFrg.png" /><figcaption><a href="https://www.makesense.ai/">Tela inicial da aplicação</a></figcaption></figure><p>We will need some software to set up our work environment. Below, I will list and explain each of them:</p><ol><li><a href="https://git-scm.com/download/win"><strong>Git</strong></a>: A version control system that will allow you to access and clone code repositories.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*hG80mUEDKp100i-YK9yBOw.png" /><figcaption>Access the <a href="https://git-scm.com/">Git page</a> and look for the download link as shown above.</figcaption></figure><p>Download and run the .exe file. The installation is basically clicking “Next” and waiting.</p><p><strong>2. </strong><a href="https://www.docker.com/products/docker-desktop/"><strong>Docker Desktop</strong></a>: Will create a virtual environment on your machine, essential for running the application we will use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RbEQnwHacvhaBelref1nMQ.png" /><figcaption>Just click on “Download for Windows”.</figcaption></figure><p>Here the installation is also like the previous step. Once the installation is complete, open Docker and leave it minimized.</p><p><strong>3. </strong><a href="https://nodejs.org/en"><strong>Node.js</strong></a>: Includes npm, a package manager that will help us install necessary libraries and dependencies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qa50r1YZSnL8EECMFE-2bg.png" /><figcaption>Here it is also simple, choose “Download Node.js LTS”.</figcaption></figure><p>Another simple installation, it is not necessary to change the checkboxes during the installation process, click “Next” on the windows, and wait.</p><h3>Cloning the Repository</h3><p>Now it’s basically command line. Access the start menu and look for the application “Git CMD,” which is the Git command environment, where we will execute the necessary commands.</p><p>After accessing Git CMD, execute the command:</p><pre>git -v</pre><p>It will return the version of Git installed on your machine, indicating success in the installation you performed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bMg4oHuD-BjafXaD0ohcLg.png" /><figcaption>Git CMD Screen</figcaption></figure><p>If you are interested, you can navigate through the directories via Git CMD to define where the repository to be cloned will be stored. From there, we execute the following command:</p><pre>git clone https://github.com/SkalskiP/make-sense.git</pre><p>Wait for the process to complete and type:</p><pre>cd make-sense</pre><p>Now inside the make-sense folder, type:</p><pre>npm install</pre><p>Wait for the process to complete and do not close Git CMD, we will go to the next step.</p><h3>Setting Up Docker</h3><p>Still inside the make-sense folder in Git CMD, now type the following command to build the image in Docker:</p><pre># Build Docker Image<br>docker build -t make-sense -f docker/Dockerfile .</pre><p>And now let’s run the image as a service:</p><pre># Run Docker Image as Service<br>docker run -dit -p 3000:3000 --restart=always --name=make-sense make-sense</pre><p>After waiting for the process, type the command below to see if there were any errors:</p><pre># Get Docker Container Logs<br>docker logs make-sense</pre><h3>Running the Application</h3><p>Now we have finished the installation and configuration, and we are close to accessing the application. Go back to Docker Desktop and you will see something like the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwNPSveWkm58eeR0oDzuFw.png" /><figcaption>Click on Containers and look for make-sense</figcaption></figure><p>After accessing the “make-sense” container, you will see this screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jt8aeL5DAo69YbRh3hoHKA.png" /><figcaption>Click on the <a href="http://localhost:3000/">http://localhost:3000/</a> link of your container</figcaption></figure><p>I recommend using the localhost version because it will not be necessary to access the service in a third-party environment/server. When you click on localhost, the make-sense page will automatically open in your default browser. We then see the application screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAzqJbi4ixsDzmSdDB1Fqw.png" /><figcaption>Accessed via Docker Desktop</figcaption></figure><p>Done! Now we are ready to start studying computer vision. In the next article, we will learn how to manipulate the dataset and label the images.</p><p>See you next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77c68782851f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Organize a Dataset for Computer Vision?]]></title>
            <link>https://medium.com/@alvaro.marcus/how-to-organize-a-dataset-for-computer-vision-e28afb89723f?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e28afb89723f</guid>
            <category><![CDATA[yolov8]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sun, 14 Jul 2024 02:33:10 GMT</pubDate>
            <atom:updated>2024-07-14T11:19:08.847Z</atom:updated>
            <content:encoded><![CDATA[<p>When working with computer vision, organizing the dataset is crucial. A dataset is a collection of images related to a specific subject that we want to identify and segment. To ensure the trained model is efficient, it is necessary to follow some rules.</p><h3>Image Resolution</h3><p>The resolution of the images should be standardized. If each image has a different resolution, this can cause problems in the results. For YOLOv8, for example, the ideal resolution is 640x640 pixels. Conditioning the images to this resolution is essential to avoid undesirable variables during the model training.</p><h3><strong>Diversity of Images</strong></h3><p>The diversity of images in the dataset is equally important. Let’s consider a classic scenario: detecting car license plates. If you are developing a model for car inspections, where the license plate will always be photographed from a specific position and angle, your images should reflect this setup. On the other hand, if the plates are captured by traffic cameras, the images need to show the plates under conditions that are typically seen in real traffic situations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*iO654dDsLOAL1yho.png" /><figcaption>Detection of cars in traffic — Source: <a href="https://embarcados.com.br/reconhecimento-automatico-de-placas-de-identificacao-de-veiculos-em-uma-jetson-nano-usando-yolov4-tiny-e-lprnet/">embarcados</a></figcaption></figure><h3><strong>Number of Images</strong></h3><p>The number of images is also an essential factor. In general, the more images, the better. A minimum criterion is 1000 images per class (a class is the desired output, the object to be detected and identified). However, the variety of images (different angles and sizes of objects) must be ensured so that the prediction model does not face simple problems that could compromise the results.</p><h3><strong>Data Augmentation</strong></h3><p>The process of Data Augmentation is used to increase the diversity of the dataset. This involves applying transformations such as translation, scaling, rotation, and brightness adjustment to the images. However, caution is needed. Some libraries, like Ultralytics (provider of YOLO), recommend not using Data Augmentation beforehand, as the tool itself has built-in parameters for this. Modifying these parameters inappropriately can distort the images and compromise training because repeated data augmentation could lead to the loss of essential characteristics of the object of interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*q33t-XXr910q8ANP" /><figcaption><em>Example of data augmentation Source: </em><a href="https://ubiai.tools/what-are-the-advantages-anddisadvantages-of-data-augmentation-2023-update/">ubiai.com</a></figcaption></figure><h3><strong>Labeling and Annotation</strong></h3><p>The organization of images in the dataset is fundamental. The images need to have standardized names, and the labels should be represented by coordinates indicating the position of the bounding box. This is described in a .txt file with the respective name of the annotated image. This is essential for the network to understand what needs to be detected, classified, or segmented.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*rOMNEuGZPhiaGY9x2rhSqQ.png" /><figcaption><em>Example of a folder containing images for the validation stage along with their respective label files</em></figcaption></figure><p>In the image below, we see an example of a label in the YOLOv8 format. There are basically five groups of numerical values: the first group represents the class, and the others are points representing the vertices of the rectangle on the image to be used in the validation stage. In any computer vision work, it is necessary to define the list of classes to detect. In this list, the first class receives the value zero (0), the second one (1), and so on. In the example image below, there was only one class, which is 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*kaPTox3Ncj-_znEs19u19Q.png" /><figcaption><em>File containing the label (0 is the number representing the order of a class in a table of possible classes)</em></figcaption></figure><p>We are still in the initial part and talking about computer vision superficially. Soon we will do some practical examples from scratch to testing, going through all the necessary stages.</p><p>But for now, we are getting to know the basics for better study understanding. See you soon!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e28afb89723f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Como organizar um dataset para visão computacional?]]></title>
            <link>https://medium.com/@alvaro.marcus/como-organizar-um-dataset-para-vis%C3%A3o-computacional-995ac22ce15c?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/995ac22ce15c</guid>
            <category><![CDATA[visão-computacional]]></category>
            <category><![CDATA[como-fazer]]></category>
            <category><![CDATA[inteligencia-artificial]]></category>
            <category><![CDATA[dataset]]></category>
            <category><![CDATA[yolov8]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sun, 14 Jul 2024 02:24:24 GMT</pubDate>
            <atom:updated>2024-07-14T11:19:23.868Z</atom:updated>
            <content:encoded><![CDATA[<p>Quando trabalhamos com visão computacional, a organização do dataset é crucial. Um dataset é um conjunto de imagens relacionadas a um determinado assunto que queremos identificar e segmentar. Para garantir que o modelo treinado seja eficiente, é necessário seguir algumas regras.</p><h3>Resolução das Imagens</h3><p>A resolução das imagens deve ser padronizada. Se cada imagem tiver uma resolução diferente, isso pode causar problemas nos resultados. No caso do YOLOv8, por exemplo, a resolução ideal é de 640x640 pixels. Condicionar as imagens para essa resolução é fundamental para evitar variáveis indesejadas durante o treinamento do modelo.</p><h3>Diversidade das Imagens</h3><p>A diversidade das imagens no dataset é igualmente importante. Consideramos aqui um cenário clássico: detectar placas de carro. Se você está desenvolvendo um modelo para vistorias de carros, onde a placa será sempre fotografada de uma posição e ângulo específicos, suas imagens devem refletir essa configuração. Por outro lado, se as placas forem capturadas por câmeras de trânsito, as imagens precisarão mostrar as placas sob as condições que normalmente são vistas em situação de tráfego real.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*iO654dDsLOAL1yho.png" /><figcaption>Detecção de carros em trânsito — Fonte: <a href="https://embarcados.com.br/reconhecimento-automatico-de-placas-de-identificacao-de-veiculos-em-uma-jetson-nano-usando-yolov4-tiny-e-lprnet/">embarcados</a></figcaption></figure><h3>Quantidade de Imagens</h3><p>A quantidade de imagens também é um fator essencial. Em geral, quanto mais imagens, melhor. Um critério mínimo como 1000 imagens por classe — classe é a saída desejada, o objeto a ser detectado e identificado — mas a variedade das imagens (ângulos e tamanhos diversos de objetos) deve ser garantida para que o modelo de predição não enfrente problemas simples que possam comprometer os resultados.</p><h3>Data Augmentation</h3><p>O processo de Data Augmentation (aumento de dados) é utilizado para aumentar a diversidade do dataset. Isso envolve aplicar transformações como translação, escala, rotação e ajuste de brilho nas imagens. No entanto, é preciso tomar cuidado. Algumas bibliotecas, como a Ultralytics (fornecedora do YOLO), recomendam não utilizar Data Augmentation de forma prévia, pois a própria ferramenta já possui parâmetros embutidos para isso. Modificar esses parâmetros inadequadamente pode distorcer as imagens e comprometer o treinamento, pois poderia ocorrer um data augmentation de forma repetida e levando a perda das características essencias do objeto de interesse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*q33t-XXr910q8ANP" /><figcaption>Exemplo de data augmentation Fonte: <a href="https://ubiai.tools/what-are-the-advantages-anddisadvantages-of-data-augmentation-2023-update/">ubiai.com</a></figcaption></figure><h3>Rotulação e demarcação</h3><p>A organização das imagens no dataset é fundamental. As imagens precisam ter nomes padronizados e as labels (rótulos) devem ser representadas por coordenadas, as quais vão indicar a posição da bounding box (caixa delimitadora, descrita em arquivo de extensão txt com o respectivo nome da imagem que foi demarcada. Isso é essencial para que a rede entenda o que precisa detectar, classificar ou segmentar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*rOMNEuGZPhiaGY9x2rhSqQ.png" /><figcaption>Exemplo de pasta contendo imagens para etapa de validação junto aos respectivos arquivos com os rótulos</figcaption></figure><p>Na imagem abaixo vemos um exemplo de rótulo ou label se preferir, no padrão YOLOV8. São basicamente 5 grupos de valores numéricos, o primeiro grupo é o da classe, e os demais são pontos que representam onde foram posicionados os vértices do retângulo na imagem a ser utilizada na etapa de validação. Todo trabalho com visão computacional é preciso definir a lista de classes a detectar, nessa lista a primeira classe recebe o valor zero (0), a segunda recebe um (1) e assim por diante, e na imagem do exemplo abaixo havia apenas uma classe, sendo a 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*kaPTox3Ncj-_znEs19u19Q.png" /><figcaption>Arquivo contendo o rótulo (0 é o número que representa a ordem de uma classe em uma tabela de possíveis classes)</figcaption></figure><p>Ainda estamos na parte inicial e falando da visão computacional de forma superficial, em breve vamos fazer alguns exemplos práticos do zero até o teste, passando por todas as etapas necessárias.</p><p>Mas no momento vamos conhecendo aos poucos para o estudo ser melhor aproveitado. Até mais!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=995ac22ce15c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Applications of Artificial Intelligence in Industry]]></title>
            <link>https://medium.com/@alvaro.marcus/applications-of-artificial-intelligence-in-industry-c9578efc344c?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9578efc344c</guid>
            <category><![CDATA[vale]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[industrial-automation]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sat, 06 Jul 2024 18:45:48 GMT</pubDate>
            <atom:updated>2024-07-06T18:45:48.197Z</atom:updated>
            <content:encoded><![CDATA[<p>Artificial Intelligence (AI) has become an essential tool in various industries, offering solutions that enhance efficiency, accuracy, and safety in industrial processes. But what techniques are possible? I will not detail each technique or tool at this moment; the aim is to present a general overview with some initial options.</p><p><strong>Computer Vision</strong></p><ol><li><strong>Occupational Safety Monitoring and Auditing:</strong><br> <em>Example</em>: In the construction industry, computer vision can be used to automatically detect if workers are wearing the appropriate Personal Protective Equipment (PPE) such as helmets, safety glasses, and gloves. AI-equipped cameras can identify the presence or absence of these items, helping to prevent workplace accidents. The same technique can also be applied in automotive repair companies.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*IrcSEYyM9YJTP2mQlBrcMA.png" /><figcaption>PPE detection with computer vision</figcaption></figure><p>The image above is part of an interesting study presented in the article <em>A Smart System for Personal Protective Equipment Detection in Industrial Environments Based on Deep Learning at the Edge</em>, 2022, where the author trains a detection model and embeds it in a Raspberry Pi.</p><p><strong>2. Traffic Control:</strong><br> <em>Example</em>: Computer vision techniques can be employed to monitor traffic, counting vehicles and analyzing their speeds without the need for radar. This system can detect illegal stops in prohibited areas and assist in urban traffic management.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*FqlkwKrEb_S_iXMcpsmBdQ.png" /><figcaption>Detection of cars in urban traffic</figcaption></figure><p><strong>3. Industrial Process Monitoring:</strong><br> <em>Example</em>: In mining industries, cameras can check if train wagons are in normal operating condition or if there are defects. This was developed by Leonardo Borges de Castro in his article <em>Inspeção de Componentes de Vagões Ferroviários Baseado em Visão Computacional e Aprendizagem Profunda</em>. See the image below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*m_cOBhqlSx7F0ba25nPIZg.png" /><figcaption>Detection of wagon components</figcaption></figure><p>In the electrical sector, computer vision combined with thermographic analysis can identify possible failures in electrical systems, such as excessive heating of conductors, terminals, and protection devices. See the image below of a model developed for detecting faults in insulators and bird nests in transmission lines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*Fq75Gsgu5DM2Cq8DPuMBkQ.png" /><figcaption>Detection of faults and nests</figcaption></figure><p>Details can be found in the article <em>Automated deep learning system for power line inspection image analysis and processing: architecture and design issues</em>, 2023, by Daoxing Li, Xiaohui Wang, Jie Zhang, and Zhixiang Ji<em>.</em></p><p><strong>Data Analysis and Machine Learning</strong></p><p><strong>1. Linear Regression and Neural Networks:</strong><br> <em>Example</em>: Neural networks combined with linear regression techniques can be used to predict trends in data, such as sales growth or airline ticket prices. Effective analysis of historical data is crucial for obtaining accurate forecasts.</p><p><strong>2. Memory Networks (LSTM):</strong><br> <em>Example</em>: In the financial market, LSTM (Long Short-Term Memory) neural networks are effective for estimating stock price trends based on historical data. These networks are especially good at predicting short-term trends, using large volumes of historical data to provide estimates. I will discuss this topic in another post.</p><p><strong>3. Fuzzy Logic:</strong><br> <em>Example</em>: In control systems, such as crane operations, fuzzy logic can be used to assist in machinery operation. Based on rules defined by activity specialists, the system can control the equipment safely and efficiently, ensuring correct task execution. This is another topic that requires a detailed approach; there are didactic examples on the subject.</p><p><strong>Logistics Optimization</strong></p><p><strong>1. A (A-Star) Search Algorithms*:</strong><br> <em>Example</em>: Used in logistics companies, the A* algorithm helps determine the shortest travel path between two points, optimizing delivery routes and reducing operational costs.</p><p><strong>Medicine</strong></p><p><strong>1. Exploratory Analysis of Medical Data:</strong><br> <em>Example</em>: AI techniques are used to cross-reference data from different medical exams, such as blood tests and ultrasounds, to identify potential illnesses. AI can help classify the presence or absence of diseases, offering more accurate and faster diagnoses.</p><p>Exploratory analysis is not an AI technique but a methodology using mathematical tools to explain a range of information or datasets. From exploratory data analysis, we then move on to the use of machine learning tools.</p><p><strong>Conclusion</strong></p><p>The applications of Artificial Intelligence in industry are vast and varied, ranging from computer vision to advanced data analysis and logistics process optimization. These technologies not only increase efficiency but also improve safety and decision-making.</p><p>As mentioned in some topics above, several themes will be addressed and detailed. The aim is to show that AI is not just about ChatGPT and that a good understanding of the problem is necessary to evaluate whether the results of the applied techniques are coherent or not.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9578efc344c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Computer Vision: The Eye of Artificial Intelligence]]></title>
            <link>https://medium.com/@alvaro.marcus/introduction-to-computer-vision-the-eye-of-artificial-intelligence-3170a631ae6d?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3170a631ae6d</guid>
            <category><![CDATA[image-classification]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sat, 06 Jul 2024 18:31:55 GMT</pubDate>
            <atom:updated>2024-07-08T13:20:50.040Z</atom:updated>
            <content:encoded><![CDATA[<p>Computer vision is a fascinating field within artificial intelligence that involves the ability of a system to interpret and understand the world around it based on available images. But what exactly does “computer vision” mean?</p><h3>What is Computer Vision?</h3><p>When we talk about computer vision, many people imagine robots seeing like humans. Essentially, computer vision is the use of complex mathematical models to interpret images and videos, transforming these visual informations into numerical data to find logical patterns. This can be compared to how the human brain processes visual information, but on a simplified scale.</p><h3>In Cinema</h3><p>Think of the movie “The Terminator.” In various scenes, we see the perspective of the T-800 (played by Arnold Schwarzenegger), where he analyzes and classifies threats in his surroundings.</p><figure><img alt="Uma cena do filme com a visão em primeira pessoal do exterminador." src="https://cdn-images-1.medium.com/max/1024/1*o89ytAh8BmFClmpgvhn-hQ.png" /><figcaption>Terminator 1 — Police Station Scene</figcaption></figure><figure><img alt="Uma cena do filme com a visão em primeira pessoal do exterminador." src="https://cdn-images-1.medium.com/max/815/1*9KKgaomHRPrd4h8qGhFQOA.png" /><figcaption>Terminator 2 — Cyberdyne Scene</figcaption></figure><p>Although it’s a science fiction movie, these scenes illustrate well a fictional idea of computer vision. Today, we have real applications that assist humans or even machines in classifying or detecting situations of interest, whether in the civil or military spheres.</p><h3>Fundamental Concepts: Classification, Detection, and Segmentation</h3><p>Computer vision can be divided into three main tasks: classification, detection, and segmentation.</p><p><strong>Classification</strong>: Imagine a photo containing a cat. The task of classification involves identifying what is in the image, such as “cat” or “dog,” for example.</p><p><strong>Detection</strong>: Besides identifying, detection determines the location of objects in the image. In the example of the photo, it would be identifying where the cat is positioned.</p><p><strong>Segmentation</strong>: This is the most detailed task, involving drawing contours around objects in the image, precisely defining where each object is located.</p><figure><img alt="Uma imagem contendo exemplo de classificação, detecção e segmentação. Primeiro, a imagem é classificada como “gato”, na segunda q, é detectado o gato na imagem contornando o mesmo com um retângulo, o terceiro é feita a segmentação colorindo todo o gato." src="https://cdn-images-1.medium.com/max/695/1*JtqjNmsc1s2JB5LuJ_4fBg.png" /><figcaption>Classic and didactic image showing classification, detection, and segmentation.</figcaption></figure><h3>Free Computer Vision Tools</h3><p>There are various tools available for implementing computer vision, and many of them are free. One of the most popular is YOLO (You Only Look Once). This algorithm is known for its ability to detect objects in real-time with high accuracy. Currently, all documentation is maintained and provided by Ultralytics.</p><h3>Implementing YOLO</h3><p>To start using YOLO, you need a computer with internet access to access the documentation. Python is often used to work with YOLO. The YOLO documentation is clear and objective, making the implementation accessible and easy to understand.</p><p>Basic installation guide for the application provided by Ultralytics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*D_aFmCBBvGhz1lD22c9utA.png" /><figcaption>Guia básico de instalação da aplicação disponibilizada pela Ultralytics</figcaption></figure><h3>The Importance of Training</h3><p>Computer vision, like any artificial intelligence technology, depends on data to learn. The process of training a model involves providing numerous images for it to learn to identify and classify objects of interest. Think of it like teaching a small child: if you provide precise and clear information, the child will learn quickly. Similarly, a computer vision model will learn from the data you provide.</p><h3>Conclusion</h3><p>Computer vision is a powerful tool that mimics the human ability to interpret visual information. With the continuous evolution of tools and algorithms like YOLO, this technology is becoming increasingly accessible and efficient. Understanding the concepts of classification, detection, and segmentation is crucial to harnessing the full potential of computer vision and effectively applying it to various real-world problems.</p><p>In the next posts, we will explore practical examples and detail how you can start implementing these techniques in your projects. See you next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3170a631ae6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introdução à Visão Computacional: O Olho da Inteligência Artificial]]></title>
            <link>https://medium.com/@alvaro.marcus/introdu%C3%A7%C3%A3o-%C3%A0-vis%C3%A3o-computacional-o-olho-da-intelig%C3%AAncia-artificial-748a89e02073?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/748a89e02073</guid>
            <category><![CDATA[classificação-de-imagens]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[inteligência-artificial]]></category>
            <category><![CDATA[aprendizado-profundo]]></category>
            <category><![CDATA[visão-computacional]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sat, 06 Jul 2024 18:20:21 GMT</pubDate>
            <atom:updated>2024-07-08T13:19:31.324Z</atom:updated>
            <content:encoded><![CDATA[<p>A visão computacional é um campo muito interessante dentro da inteligência artificial, que envolve a capacidade de um sistema interpretar e entender o mundo ao seu redor, com base nas imagens disponíveis. Mas o que exatamente significa “visão computacional”?</p><h3>O Que é Visão Computacional?</h3><p>Quando falamos de visão computacional, muitas pessoas imaginam robôs enxergando como humanos. Essencialmente, a visão computacional é o uso de modelos matemáticos complexos para interpretar imagens e vídeos, transformando essas informações visuais em dados numéricos para encontrar padrões lógicos. Isso pode ser comparado à maneira como o cérebro humano processa a informação visual, mas em uma escala simplificada.</p><h3>No cinema</h3><p>Pense no filme “O Exterminador do Futuro”. Em várias cenas, vemos a perspectiva do T-800 (interpretado por Arnold Schwarzenegger), onde ele analisa e classifica as ameaças no ambiente a sua volta.</p><figure><img alt="Uma cena do filme com a visão em primeira pessoal do exterminador." src="https://cdn-images-1.medium.com/max/1024/1*o89ytAh8BmFClmpgvhn-hQ.png" /><figcaption>Terminator 1 — Cena do departamento de polícia</figcaption></figure><figure><img alt="Uma cena do filme com a visão em primeira pessoal do exterminador." src="https://cdn-images-1.medium.com/max/815/1*9KKgaomHRPrd4h8qGhFQOA.png" /><figcaption>Terminator 2 — Cena na Cyberdyne</figcaption></figure><p>Apesar de ser um filme de ficção científica, essas cenas ilustram bem uma ideia de visão computacional ficcional, mas hoje em dia temos aplicações que reais que auxiliam humanos ou mesmo máquinas a classificar ou detectar uma situação de interesse, seja no âmbito civil ou militar.</p><h3>Conceitos Fundamentais: Classificação, Detecção e Segmentação</h3><p>A visão computacional pode ser dividida em três principais tarefas: classificação, detecção e segmentação.</p><ol><li><strong>Classificação</strong>: Imagine uma foto contendo um gato. A tarefa de classificação envolve identificar o que está na imagem, como “gato” ou “cachorro” por exemplo.</li><li><strong>Detecção</strong>: Além de identificar, a detecção determina a localização dos objetos na imagem. No exemplo da foto, seria identificar onde o gato está posicionado.</li><li><strong>Segmentação</strong>: Esta é a tarefa mais detalhada, que envolve desenhar contornos ao redor dos objetos na imagem, definindo precisamente onde cada objeto está localizado.</li></ol><figure><img alt="Uma imagem contendo exemplo de classificação, detecção e segmentação. Primeiro, a imagem é classificada como “gato”, na segunda q, é detectado o gato na imagem contornando o mesmo com um retângulo, o terceiro é feita a segmentação colorindo todo o gato." src="https://cdn-images-1.medium.com/max/695/1*JtqjNmsc1s2JB5LuJ_4fBg.png" /><figcaption>Imagem clássica e didática, mostrando a classificação, detecção e segmentação</figcaption></figure><h3>Ferramentas Gratuitas de Visão Computacional</h3><p>Existem diversas ferramentas disponíveis para implementar visão computacional, e muitas delas são gratuitas. Uma das mais populares é o YOLO (You Only Look Once). Este algoritmo é conhecido pela sua capacidade de detectar objetos em tempo real com alta precisão. Atualmente, toda a documentação é mantida e disponibilizada pela Ultralytics.</p><h3>Implementando YOLO</h3><p>Para começar a usar o YOLO, você precisa de um computador com acesso à internet para acessar a documentação. A linguagem Python é frequentemente utilizada para trabalhar com a YOLO. A documentação do YOLO é clara e objetiva, tornando a implementação acessível e fácil de ser entendida.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*D_aFmCBBvGhz1lD22c9utA.png" /><figcaption>Guia básico de instalação da aplicação disponibilizada pela Ultralytics</figcaption></figure><h3>A Importância do Treinamento</h3><p>A visão computacional, como qualquer tecnologia de inteligência artificial, depende de dados para aprender. O processo de treinar um modelo envolve fornecer inúmeras imagens para que ele aprenda a identificar e classificar objetos de interesse. Pense nisso como ensinar uma criança pequena: se você fornecer informações precisas e claras, a criança aprenderá rapidamente. Da mesma forma, um modelo de visão computacional aprenderá com os dados que você fornecer.</p><h3>Conclusão</h3><p>A visão computacional é uma ferramenta poderosa que imita a capacidade humana de interpretar informações visuais. Com a evolução contínua das ferramentas e algoritmos, como o YOLO, esta tecnologia está se tornando cada vez mais acessível e eficiente. Entender os conceitos de classificação, detecção e segmentação é crucial para aproveitar todo o potencial da visão computacional e aplicá-la efetivamente em diversos problemas do mundo real.</p><p>Nos próximos posts, exploraremos exemplos práticos e detalharemos como você pode começar a implementar essas técnicas em seus projetos. Até mais!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=748a89e02073" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Aplicações da Inteligência Artificial na Indústria]]></title>
            <link>https://medium.com/@alvaro.marcus/aplica%C3%A7%C3%B5es-da-intelig%C3%AAncia-artificial-na-ind%C3%BAstria-069dc50987da?source=rss-72eeebb8425d------2</link>
            <guid isPermaLink="false">https://medium.com/p/069dc50987da</guid>
            <category><![CDATA[visão-computacional]]></category>
            <category><![CDATA[inteligência-artificial]]></category>
            <category><![CDATA[automação-industrial]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[vale]]></category>
            <dc:creator><![CDATA[Alvaro S. Marcus]]></dc:creator>
            <pubDate>Sat, 06 Jul 2024 03:16:54 GMT</pubDate>
            <atom:updated>2024-07-06T03:16:54.157Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<p>A Inteligência Artificial (IA) tem se tornado uma ferramenta essencial em diversas indústrias, oferecendo soluções que aumentam a eficiência, precisão e segurança dos processos industriais. Mas quais as técnicas possíveis? Não vou nesse momento, detalhar cada técnica ou ferramentas, o intuito é apresentar um panorama geral com algumas opções iniciais.</p><p><strong>Visão Computacional</strong></p><ol><li><strong>Fiscalização e Auditoria de Segurança do Trabalho:</strong><br> — Exemplo: Na construção civil, a visão computacional pode ser utilizada para detectar automaticamente se os trabalhadores estão utilizando os Equipamentos de Proteção Individual (EPIs) adequados, como capacetes, óculos de segurança e luvas. Câmeras equipadas com IA podem identificar a presença ou ausência desses itens, ajudando a prevenir acidentes de trabalho. A mesma técnicas também pode ser aplicada em empresas de reparos automotivos.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*IrcSEYyM9YJTP2mQlBrcMA.png" /><figcaption>Detecção de EPI com visão computacional</figcaption></figure><p>A imagem acima faz parte de um estudo interessante apresentado no artigo <em>A Smart System for Personal Protective Equipment Detection in Industrial Environments Based on Deep Learning at the Edge, 2022. </em>No qual o autor treina um modelo de detecção e embarca em um Raspberry Pi.</p><p><strong>2. Controle de Tráfego:</strong><br> — Exemplo: Técnicas de visão computacional podem ser empregadas para monitorar o tráfego, contando veículos e analisando suas velocidades sem a necessidade de radares. Esse sistema pode detectar paradas irregulares em locais proibidos e auxiliar na gestão do tráfego urbano.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*FqlkwKrEb_S_iXMcpsmBdQ.png" /><figcaption>Detecção de carros em tráfego urbano</figcaption></figure><p><strong>3. Monitoramento de Processos Industriais:</strong><br> — Exemplo: Em indústrias de mineração, câmeras podem verificar se os vagões de trem estão em condições normais de operação ou se existem defeitos. Como no exemplo desenvolvido por Leonardo Borges de Castro em seu artigo <em>Inspeção de Componentes de Vagões Ferroviários Baseado em Visão Computacional e Aprendizagem Profunda. </em>Ver imagem abaixo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*m_cOBhqlSx7F0ba25nPIZg.png" /><figcaption>Detecção de componentes dos vagões</figcaption></figure><p>No setor elétrico, a visão computacional combinada com análise termográfica pode identificar possíveis falhas em sistemas elétricos, como o aquecimento excessivo de condutores, terminais e dispositivos de proteção. Veja a imagem a seguir de um modelo desenvolvido para detecção de falhas em isoladores e ninhos de aves em linhas de transmissão:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*Fq75Gsgu5DM2Cq8DPuMBkQ.png" /><figcaption>Detecção de falhas e ninhos</figcaption></figure><p>Detalhes podem ser conferidos no artigo <em>Automated deep learning system for power line inspection image analysis and processing: architecture and design issues, 2023. Dos autores Daoxing Li , Xiaohui Wang , Jie Zhang , Zhixiang Ji.</em></p><p><strong>Análise de Dados e Machine Learning</strong></p><p><strong>1. Regressão Linear e Redes Neurais:</strong><br> — Exemplo: Redes neurais associadas a técnicas de regressão linear podem ser utilizadas para prever tendências em dados, como o crescimento de vendas ou preços de passagens aéreas. A análise eficaz dos dados históricos é crucial para obter previsões precisas.</p><p><strong>2. Redes com Memória (LSTM):</strong><br> — Exemplo: No mercado financeiro, redes neurais LSTM (Long Short-Term Memory) são eficazes para estimativa de tendências dos preços de ações com base em dados históricos. Essas redes são especialmente boas para prever tendências de curto prazo, utilizando grandes volumes de dados históricos para fornecer estimativas. Em outro post vou discorrer sobre esse assunto.</p><p><strong>3. Lógica Fuzzy:</strong><br> — Exemplo: Em sistemas de controle, como operações de guindastes, a lógica fuzzy pode ser utilizada para auxiliar na operação do maquinário. Baseando-se nas regras definidas por especialistas da atividade, o sistema pode controlar o equipamento de forma segura e eficiente, garantindo a execução correta das tarefas. Esse é outro tópico que pede uma abordagem detalhada, existem exemplos didáticos a respeito do tema.</p><p><strong>Otimização de Logística</strong></p><p><strong>1. Algoritmos de Busca A* (A-Star):</strong><br> — Exemplo: Utilizado em empresas de logística, o algoritmo A* ajuda a determinar o menor caminho de deslocamento entre dois pontos, otimizando rotas de entrega e reduzindo custos operacionais.</p><p><strong>Medicina</strong></p><p><strong>1. Análise Exploratória de Dados Médicos:</strong><br> — Exemplo: Técnicas de IA são utilizadas para cruzar dados de diferentes exames médicos, como sangue e ultrassonografias, para identificar possíveis enfermidades. A IA pode ajudar a classificar a presença ou ausência de doenças, oferecendo diagnósticos mais precisos e rápidos.</p><p>A análise exploratória não representa uma técnica de IA e sim uma metodologia utilizando de ferramentas matemáticas para explicar uma gama de informações ou dataset, a partir da análise exploratória dos dados, partimos então para o uso das ferramentas de aprendizado de máquina.</p><p><strong>Conclusão</strong></p><p>As aplicações da Inteligência Artificial na indústria são vastas e variadas, abrangendo desde a visão computacional até a análise avançada de dados e otimização de processos logísticos. Estas tecnologias não apenas aumentam a eficiência, mas também melhoram a segurança e a tomada de decisões.</p><p>Como falei em alguns tópicos acima, vários temas serão abordados e detalhados. O intuito é mostrar que IA não se resume apenas em chatGPT e que é necessário um bom entendimento do problema para avaliar se os resultados das técnicas aplicadas estão coerentes, ou não.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=069dc50987da" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>