<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Brenner Cruvinel - compressão</title>
    <subtitle>AI researcher and product designer building at the edge of computer science and mental health.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://brennercruvinel.blog/tags/compressao/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://brennercruvinel.blog"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-03-12T00:00:00+00:00</updated>
    <id>https://brennercruvinel.blog/tags/compressao/atom.xml</id>
    <entry xml:lang="en">
        <title>Compressão de Imagem para Melhorar Computer Vision</title>
        <published>2026-03-12T00:00:00+00:00</published>
        <updated>2026-03-12T00:00:00+00:00</updated>
        
        <author>
          <name>
            Brenner Cruvinel
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://brennercruvinel.blog/blog/compressao-imagem-computer-vision/"/>
        <id>https://brennercruvinel.blog/blog/compressao-imagem-computer-vision/</id>
        
        <content type="html" xml:base="https://brennercruvinel.blog/blog/compressao-imagem-computer-vision/">&lt;h2 id=&quot;using-image-compression-to-improve-computer-vision-part-1&quot;&gt;using image compression to improve computer vision, part 1&lt;&#x2F;h2&gt;
&lt;p&gt;clipping de referencia. Kaleigh Mentzer, Granica, 4 de novembro de 2023, fonte https:&#x2F;&#x2F;www.granica.ai&#x2F;blog&#x2F;using-image-compression-to-improve-computer-vision-part-1 . a tese que importa pro dermML: imagem de treino comprime ate niveis altos sem perda de acuracia, porque o modelo ignora a informacao de alta frequencia que a compressao joga fora. a parte 2 esta em [[image-compression-improve-cv-part-2]].&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-serie&quot;&gt;a serie&lt;&#x2F;h3&gt;
&lt;p&gt;multi-part series sobre como time de ML pode usar compressao com perda pra melhorar modelo de computer vision. a parte 1 mostra que imagem de treino pode ser comprimida pra reduzir storage sem sacrificar performance. a parte 2 mostra como o espaco liberado acomoda dado de treino adicional comprimido, melhorando performance dentro de orcamento fixo.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;o-problema-de-storage&quot;&gt;o problema de storage&lt;&#x2F;h3&gt;
&lt;p&gt;modelo de computer vision state-of-the-art demanda muito dado de imagem, o que cria requisito de storage caro. muito time de ML enfrenta restricao implicita de storage que resulta em ate 70% do dado novo sendo arquivado ou deletado.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fundamentos-de-compressao&quot;&gt;fundamentos de compressao&lt;&#x2F;h3&gt;
&lt;p&gt;lossless vs lossy: a lossless permite reconstrucao exata mas tipicamente alcanca so ~50% de reducao pra imagem fotografica. a lossy permite degradacao perceptual sem afetar a performance do modelo, com potencial de comprimir a imagem ate poucos pontos percentuais do tamanho original.&lt;&#x2F;p&gt;
&lt;p&gt;distancia de Butteraugli: a metrica de distancia de Butteraugli mede a mudanca de qualidade percebida. JPEG XL e codec moderno similar permitem comprimir ate uma distancia de Butteraugli especificada minimizando o tamanho do arquivo.&lt;&#x2F;p&gt;
&lt;p&gt;data compression rate (DCR): DCR = 1 - (compressed size &#x2F; uncompressed size). DCR maior indica arquivo menor. o teste mostra que o DCR cresce rapido conforme a distancia de Butteraugli aumenta.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resultados-experimentais&quot;&gt;resultados experimentais&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;classificacao-de-imagem&quot;&gt;classificacao de imagem&lt;&#x2F;h4&gt;
&lt;p&gt;dataset Food101 (75.750 train, 25.250 test, 101 categorias de comida). modelo testado: Vision Transformer (ViT) pre-treinado em ImageNet, SwAV features com ResNet-50. achado: a compressao tem impacto minimo na acuracia ate exceder ~70% de taxa de compressao. o modelo e mais sensivel a compressao do test set do que a do dado de treino.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;object-detection&quot;&gt;object detection&lt;&#x2F;h4&gt;
&lt;p&gt;dataset PASCAL VOC 2012 (5.717 imagens de treino, 20 classes de objeto). modelo Faster R-CNN com backbone ResNet-50. metrica mean average precision (mAP). resultado: o nivel de compressao do test set determina a acuracia, a compressao do training set tem impacto minimo.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;semantic-segmentation&quot;&gt;semantic segmentation&lt;&#x2F;h4&gt;
&lt;p&gt;dataset Cityscapes (5.000 imagens com anotacao semantica). modelo Segformer com encoder ImageNet pre-treinado. metrica mean intersection over union (mIoU) e mean accuracy (mAcc). achado-chave: modelo pode ser treinado em dado comprimido em 97%, requerendo so 3% do storage original de treino, sem degradacao significativa nessa metrica.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;por-que-a-compressao-tem-impacto-limitado&quot;&gt;por que a compressao tem impacto limitado&lt;&#x2F;h3&gt;
&lt;p&gt;a compressao com perda descarta a informacao perceptualmente menos importante primeiro, tipicamente cor e componente de alta frequencia. o modelo de ML talvez tambem nao dependa muito dessa informacao.&lt;&#x2F;p&gt;
&lt;p&gt;arquitetura JPEG&#x2F;JPEG XL, os dois formatos: 1. convertem RGB pra YCbCr, 2. downsample do canal de chrominancia (humano e ~3x menos sensivel a cor que a luminancia), 3. dividem a imagem em bloco de 8x8 pixels, 4. aplicam discrete cosine transform (DCT) pra decompor o componente de frequencia, 5. quantizam agressivamente o coeficiente de alta frequencia preservando a precisao do de baixa frequencia.&lt;&#x2F;p&gt;
&lt;p&gt;analise de sensibilidade do modelo: teste com perturbacao de um unico coeficiente DCT em 32 imagens do Food101 mostrou que o modelo e significativamente menos sensivel a mudanca de alta frequencia. isso e evidencia de que o artefato de compressao afeta minimamente a predicao porque o modelo nao depende da informacao de alta frequencia descartada.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conclusao&quot;&gt;conclusao&lt;&#x2F;h3&gt;
&lt;p&gt;imagem de treino pode ser comprimida substancialmente sem perda de acuracia relevante em varias tarefas de computer vision. o modelo demonstra robustez ao artefato de compressao, provavelmente porque ignora a informacao de alta frequencia que a compressao remove. tarefa diferente pode exigir nivel de compressao diferente conforme o requisito de acuracia, mas comprimir alem de PNG&#x2F;JPEG oferece economia de storage significativa com impacto minimo na performance.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;using-image-compression-to-improve-computer-vision-part-2&quot;&gt;using image compression to improve computer vision, part 2&lt;&#x2F;h2&gt;
&lt;p&gt;clipping de referencia. Granica, fonte https:&#x2F;&#x2F;www.granica.ai&#x2F;blog&#x2F;using-image-compression-to-improve-computer-vision-part-2 . continuacao de [[image-compression-improve-cv-part-1]]. o resultado que importa: mais imagem mesmo que mais comprimida melhora o modelo em mais de 10 pontos de acuracia, sem aumentar o custo de storage, quando o modelo opera em regime de dado escasso.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;a-oportunidade&quot;&gt;a oportunidade&lt;&#x2F;h3&gt;
&lt;p&gt;empresa costuma operar com orcamento fixo de cloud storage pro dado de treino. enquanto a operacao gera dado novo em volume, a restricao de orcamento forca a deletar dataset potencialmente valioso. a compressao de imagem permite reter mais dado de treino dentro do mesmo storage: quanto maior o nivel de compressao, mais imagem adicional cabe.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;o-experimento&quot;&gt;o experimento&lt;&#x2F;h3&gt;
&lt;p&gt;usa o dataset Food101, 101 tipos de comida pra classificacao. testaram seis niveis de compressao JPEG XL, medindo a compressao por distancia de Butteraugli (0, 2, 4, 6, 8 e 10), onde distancia maior indica mais perda de qualidade.&lt;&#x2F;p&gt;
&lt;p&gt;com orcamento de 0.5 GB de storage:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;formato JPEG original: 9.985 imagens cabem no orcamento&lt;&#x2F;li&gt;
&lt;li&gt;na distancia de Butteraugli 10: aproximadamente 5.6 vezes mais imagem cabe&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;a analise mostra que mais compressao permite caber substancialmente mais amostra de treino dentro da mesma restricao de storage.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;o-resultado&quot;&gt;o resultado&lt;&#x2F;h3&gt;
&lt;p&gt;testando um Vision Transformer pre-treinado em ImageNet-21k e fine-tuned em subconjuntos do Food101, ter mais imagem, mesmo que mais comprimida com perda, melhora a performance do modelo.&lt;&#x2F;p&gt;
&lt;p&gt;achado-chave: a acuracia do modelo melhorou mais de 10 pontos percentuais sem aumentar o custo de storage. pra esse modelo operando em regime de dado limitado, com menos de 100 imagens por classe, a quantidade provou ser mais valiosa que a qualidade da imagem.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implicacoes&quot;&gt;implicacoes&lt;&#x2F;h3&gt;
&lt;p&gt;conforme o modelo de ML cresce e demanda mais dado de treino pra performance otima, a compressao com perda apresenta uma solucao pratica. o time pode expandir o dataset de treino e potencialmente fazer deploy de modelo mais sofisticado sem cloud storage adicional ou aumento de orcamento.&lt;&#x2F;p&gt;
&lt;p&gt;a analise enfatiza que modelo diferente exibe padrao de scaling diferente. o sucesso depende de entender se um modelo especifico opera numa situacao de dado escasso onde amostra adicional gera melhora relevante.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;datasets-de-dermatologia-recuperacao-e-download&quot;&gt;datasets de dermatologia, recuperacao e download&lt;&#x2F;h2&gt;
&lt;p&gt;guia de download pra recriar o ambiente completo. o sistema ja suporta busca por similaridade mas os datasets foram perdidos (SSD NVMe). esta nota lista os principais datasets com comando de download e prioridade. o inventario completo do mundo esta em [[dermML-master-dataset-catalog]].&lt;&#x2F;p&gt;
&lt;h3 id=&quot;ja-indexados-arquivo-perdido&quot;&gt;ja indexados (arquivo perdido)&lt;&#x2F;h3&gt;
&lt;p&gt;HAM10000, Harvard Dataverse. indexado, arquivo perdido. 10.015 imagens (~5GB), dermoscopia, 7 tipos de lesao pigmentada.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; oficial: https:&#x2F;&#x2F;dataverse.harvard.edu&#x2F;dataset.xhtml?persistentId=doi:10.7910&#x2F;DVN&#x2F;DBW86T&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;ham10000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;wget&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; https:&#x2F;&#x2F;isic-challenge-data.s3.amazonaws.com&#x2F;2018&#x2F;ISIC2018_Task3_Training_Input.zip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;unzip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ISIC2018_Task3_Training_Input.zip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;diagnostico: melanoma (1113), melanocytic nevus (6705), basal cell carcinoma (514), actinic keratosis (327), benign keratosis (1099), dermatofibroma (115), vascular lesion (142).&lt;&#x2F;p&gt;
&lt;p&gt;BCN20000, Barcelona Dermatology Dataset. indexado, arquivo perdido. 25.331 imagens (~12GB), dermoscopia, 8 categorias.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; requer solicitacao: https:&#x2F;&#x2F;challenge2019.isic-archive.com&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; ou ISIC Archive: https:&#x2F;&#x2F;www.isic-archive.com&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;bcn20000&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;SCIN, Skin Cancer Image Network. indexado, arquivo perdido. 10.379 imagens (~3GB), fotografia clinica, multiplas condicoes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; requer registro: https:&#x2F;&#x2F;www.isic-archive.com&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;scin&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;datasets-a-adicionar&quot;&gt;datasets a adicionar&lt;&#x2F;h3&gt;
&lt;p&gt;ISIC 2024 Challenge. 400.000+ imagens, dermoscopia mais clinica. acesso https:&#x2F;&#x2F;challenge2024.isic-archive.com&#x2F; .&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;isic2024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;isic2024&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; download via ISIC API ou Kaggle&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ISIC 2020 Challenge. 33.126 imagens, dermoscopia, melanoma 584 casos.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;isic2020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;isic2020&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;kaggle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; competitions&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; download&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; siim-isic-melanoma-classification&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ISIC 2019 Challenge. 25.331 imagens, dermoscopia, 8 classes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;isic2019&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;isic2019&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;kaggle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; competitions&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; download&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;c&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; isic-2019&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;ISIC 2018 Challenge. 10.015 imagens (HAM10000), dermoscopia, 7 classes. ja temos como HAM10000.&lt;&#x2F;p&gt;
&lt;p&gt;Fitzpatrick17k. 16.577 imagens (~2GB), fotografia clinica, fototipo I-VI, 114 condicoes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;fitzpatrick17k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;fitzpatrick17k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; GitHub: https:&#x2F;&#x2F;github.com&#x2F;mattgroh&#x2F;fitzpatrick17k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; clone&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; https:&#x2F;&#x2F;github.com&#x2F;mattgroh&#x2F;fitzpatrick17k.git&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; fitzpatrick17k&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;python&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; download_images.py&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; ou baixar direto (se disponivel):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; wget https:&#x2F;&#x2F;vault.sfu.ca&#x2F;index.php&#x2F;s&#x2F;cMuxZNzk6UUHNmX (arquivo do paper DermSynth3D)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;metadado: CSV com URL, diagnostico, fototipo Fitzpatrick.&lt;&#x2F;p&gt;
&lt;p&gt;PAD-UFES-20. 2.298 imagens (~500MB), fotografia clinica com smartphone, 6 doencas. metadado clinico completo (idade, regiao, historico).&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;pad-ufes-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;pad-ufes-20&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;kaggle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; datasets&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; download&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;d&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; mahdavi1202&#x2F;skin-cancer&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;unzip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; skin-cancer.zip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; ou direto: https:&#x2F;&#x2F;data.mendeley.com&#x2F;datasets&#x2F;zr7vgbcyr2&#x2F;1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;classes: Basal Cell Carcinoma (BCC), Squamous Cell Carcinoma (SCC), Actinic Keratosis (ACK), Seborrheic Keratosis (SEK), Bowen’s Disease (BOD), Melanoma (MEL).&lt;&#x2F;p&gt;
&lt;p&gt;Derm7pt. 2.000+ imagens, dermoscopia, anotacao 7-point checklist pra melanoma.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;derm7pt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;derm7pt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; requer registro: http:&#x2F;&#x2F;derm.cs.sfu.ca&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;7-point checklist: 1. atypical pigment network, 2. blue-whitish veil, 3. atypical vascular pattern, 4. irregular streaks, 5. irregular dots&#x2F;globules, 6. irregular blotches, 7. regression structures.&lt;&#x2F;p&gt;
&lt;p&gt;PH2, Pedro Hispano Hospital. 200 imagens (~50MB), dermoscopia, segmentacao manual por dermatologista.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;ph2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;ph2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; oficial: https:&#x2F;&#x2F;www.fc.up.pt&#x2F;addi&#x2F;ph2%20database.html&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;wget&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; https:&#x2F;&#x2F;www.dropbox.com&#x2F;s&#x2F;k88qukc20ljnbuo&#x2F;PH2Dataset.rar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;unrar&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; x&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; PH2Dataset.rar&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;classes: common nevus (80), atypical nevus (80), melanoma (40).&lt;&#x2F;p&gt;
&lt;p&gt;DermoFit Image Library. 1.300 imagens, fotografia clinica de alta qualidade, 10 classes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;dermofit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;dermofit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; requer licenca paga: https:&#x2F;&#x2F;licensing.edinburgh-innovations.ed.ac.uk&#x2F;product&#x2F;dermofit-image-library&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; ~500 GBP pra licenca academica perpetua&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;classes: Actinic Keratosis, Basal Cell Carcinoma, Melanocytic Nevus, Squamous Cell Carcinoma, Seborrhoeic Keratosis, Intraepithelial Carcinoma, Pyogenic Granuloma, Haemangioma, Dermatofibroma, Melanoma.&lt;&#x2F;p&gt;
&lt;p&gt;DDI, Diverse Dermatology Images. 656 imagens, fotografia clinica, foco em tom de pele diverso.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;ddi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;ddi&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; GitHub: https:&#x2F;&#x2F;github.com&#x2F;ddrestrepo&#x2F;diverse-dermatology-images&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; clone&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; https:&#x2F;&#x2F;github.com&#x2F;ddrestrepo&#x2F;diverse-dermatology-images.git&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;FUSeg, Foot Ulcer Segmentation. 1.210 imagens, fotografia clinica de ulcera, segmentacao pixel-wise.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;fuseg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;fuseg&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; GitHub: https:&#x2F;&#x2F;github.com&#x2F;uwm-bigdata&#x2F;wound-segmentation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;git&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; clone&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; https:&#x2F;&#x2F;github.com&#x2F;uwm-bigdata&#x2F;wound-segmentation.git&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cp&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; wound-segmentation&#x2F;data&#x2F;Foot&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;\ &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Ulcer&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;\ &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Segmentation&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;\ &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Challenge&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;*&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; .&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; ou mirror: https:&#x2F;&#x2F;vault.sfu.ca&#x2F;index.php&#x2F;s&#x2F;2mb8kZg8wOltptT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Pratheepan, Skin Detection. 78 imagens, fotografia clinica (face), segmentacao de pele vs background.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;pratheepan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;pratheepan&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; website: https:&#x2F;&#x2F;web.fsktm.um.edu.my&#x2F;~cschan&#x2F;downloads_skin_dataset.html&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; Google Drive link na pagina&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;SD-198 e SD-260. 6.584 imagens (198 classes) mais 40.000+ (260 classes), crawled da web, fonte DermNet, Dermis.net, DermQuest.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;sd-{198,260}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; paper: https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;1911.08716&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; requer contato com autores&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;DermNet NZ. 23.000+ imagens, fotografia clinica educacional, 600+ condicoes.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;dermnet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;dermnet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; Kaggle (subset):&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;kaggle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; datasets&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; download&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;d&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; shubhamgoel27&#x2F;dermnet&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;unzip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; dermnet.zip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;datasets-sinteticos&quot;&gt;datasets sinteticos&lt;&#x2F;h3&gt;
&lt;p&gt;DermSynth3D. ~52.000 imagens sinteticas (~15GB), renderizacao 3D com anotacao rica (segmentacao, depth, anatomia, bbox). ja documentado em DERMSYNTH3D_SETUP.md.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;dermsynth3d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;dermsynth3d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; requer solicitacao: https:&#x2F;&#x2F;cvi2.uni.lu&#x2F;3dbodytexdermsynth&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;3DBodyTex.v1. ~50GB, scan 3D texturizado de corpo humano, base pro DermSynth3D.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;mkdir&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;3dbodytex-1.1-highres&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;cd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ~&#x2F;dermML-models&#x2F;datasets&#x2F;3dbodytex-1.1-highres&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; requer licenca: https:&#x2F;&#x2F;cvi2.uni.lu&#x2F;3dbodytexv1&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;estrutura-de-diretorios&quot;&gt;estrutura de diretorios&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;~&lt;&#x2F;span&gt;&lt;span&gt;&#x2F;dermML-models&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;  datasets&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    ham10000&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                 #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 10k dermoscopia&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    bcn20000&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                 #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 25k dermoscopia&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    scin&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                     #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 10k clinica&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    isic2024&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                 #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 400k+ (novo)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    isic2020&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                 #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 33k melanoma&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    isic2019&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                 #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 25k 8-classes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    fitzpatrick17k&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;           #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 16k diversidade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    pad-ufes-20&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;              #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 2k smartphone&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    derm7pt&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 2k 7-point checklist&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    ph2&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                      #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 200 alta qualidade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    dermofit&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                 #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 1.3k licenca paga&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    ddi&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                      #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 656 diversidade&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    fuseg&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                    #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 1.2k ulcera&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    pratheepan&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;               #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 78 skin detection&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    sd-198&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                   #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 6k 198 classes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    sd-260&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                   #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 40k 260 classes&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    dermnet&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 23k educacional&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    dermsynth3d&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;              #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 52k sintetico&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    3dbodytex-1.1-highres&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;    #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; scan 3D&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;  similarity&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    embeddings.index&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;          #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; FAISS atual (HAM+BCN+SCIN)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    metadata.db&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;               #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; SQLite metadado&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;  dermsynth&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;                  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; sinteticos separados&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    embeddings_dermsynth.index&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    metadata_dermsynth.db&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;prioridade-de-download&quot;&gt;prioridade de download&lt;&#x2F;h3&gt;
&lt;p&gt;tier 1, essencial, ja temos mas perdido: HAM10000 (10k dermoscopia, base), BCN20000 (25k dermoscopia, volume), SCIN (10k clinica, diversidade).&lt;&#x2F;p&gt;
&lt;p&gt;tier 2, muito importante, adicionar: ISIC 2024 (400k+, maior disponivel), Fitzpatrick17k (16k, diversidade de tom), PAD-UFES-20 (2k, smartphone real-world).&lt;&#x2F;p&gt;
&lt;p&gt;tier 3, importante, qualidade: PH2 (200, alta qualidade, baseline), Derm7pt (2k, 7-point checklist clinico), DermNet (23k, educacional, muitas classes).&lt;&#x2F;p&gt;
&lt;p&gt;tier 4, especializado: DermSynth3D (52k sintetico, anotacao rica), FUSeg (1.2k ulcera, nicho mas util), DDI (656, benchmark de diversidade).&lt;&#x2F;p&gt;
&lt;p&gt;tier 5, opcional&#x2F;caro: DermoFit (1.3k, licenca 500 GBP), SD-198&#x2F;260 (46k, requer contato).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;tamanho-total-estimado&quot;&gt;tamanho total estimado&lt;&#x2F;h3&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;tier&lt;&#x2F;th&gt;&lt;th&gt;datasets&lt;&#x2F;th&gt;&lt;th&gt;imagens&lt;&#x2F;th&gt;&lt;th&gt;tamanho aprox&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;HAM+BCN+SCIN&lt;&#x2F;td&gt;&lt;td&gt;45k&lt;&#x2F;td&gt;&lt;td&gt;~20GB&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;ISIC24+Fitz+PAD&lt;&#x2F;td&gt;&lt;td&gt;418k&lt;&#x2F;td&gt;&lt;td&gt;~50GB&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;PH2+Derm7pt+DermNet&lt;&#x2F;td&gt;&lt;td&gt;27k&lt;&#x2F;td&gt;&lt;td&gt;~15GB&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;4&lt;&#x2F;td&gt;&lt;td&gt;DermSynth+FUSeg+DDI&lt;&#x2F;td&gt;&lt;td&gt;54k&lt;&#x2F;td&gt;&lt;td&gt;~20GB&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;5&lt;&#x2F;td&gt;&lt;td&gt;DermoFit+SD&lt;&#x2F;td&gt;&lt;td&gt;48k&lt;&#x2F;td&gt;&lt;td&gt;~25GB&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;total&lt;&#x2F;td&gt;&lt;td&gt;all&lt;&#x2F;td&gt;&lt;td&gt;~592k&lt;&#x2F;td&gt;&lt;td&gt;~130GB&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;h3 id=&quot;proximos-passos&quot;&gt;proximos passos&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;estrutura de diretorios criada&lt;&#x2F;li&gt;
&lt;li&gt;criar script &lt;code&gt;scripts&#x2F;download_all_datasets.sh&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;atualizar &lt;code&gt;compute_embeddings.py&lt;&#x2F;code&gt; pra multiplos datasets&lt;&#x2F;li&gt;
&lt;li&gt;reindexar FAISS com todos os datasets&lt;&#x2F;li&gt;
&lt;li&gt;atualizar metadata.db com campo novo&lt;&#x2F;li&gt;
&lt;li&gt;testar busca com 592k imagens&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;gaps-por-escala-de-impacto-maior-primeiro&quot;&gt;gaps por escala de impacto, maior primeiro&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;diversidade de tons de pele Fitzpatrick IV-VI em escala (&amp;gt;50k imagens). afeta 2.5B+ pessoas sem representacao algoritmica adequada.&lt;&#x2F;li&gt;
&lt;li&gt;dermatologia para tons asiaticos (leste mais sul da Asia). 4B+ pessoas, modelo atual nao validado pra essa semiotica dermoscopica.&lt;&#x2F;li&gt;
&lt;li&gt;WSI dermatologico aberto em escala (&amp;gt;10k laminas 40x). a patologia digital inteira depende de dado que nao existe em formato publico.&lt;&#x2F;li&gt;
&lt;li&gt;longitudinal, lesao -&amp;gt; evolucao -&amp;gt; outcome ao longo do tempo. elimina biopsia desnecessaria globalmente, milhoes por ano.&lt;&#x2F;li&gt;
&lt;li&gt;multimodal, dermoscopia mais histopatologia mais genomica linkados por paciente. precision dermatology nao existe sem isso.&lt;&#x2F;li&gt;
&lt;li&gt;dataset EHR multi-center fora do eixo EUA&#x2F;Europa. MIMIC e single-center Boston, eICU e Philips-only, 85% do planeta nao esta representado.&lt;&#x2F;li&gt;
&lt;li&gt;dermatologia mais saude mental (comorbidade linkada, DLQI mais PHQ-9 mais imagem). psoriase, eczema, acne tem impacto psiquiatrico massivo nao quantificado em escala.&lt;&#x2F;li&gt;
&lt;li&gt;dataset padronizado de estetica antes&#x2F;depois com outcome measure validada. mercado de 100B+ USD sem dado cientifico de qualidade.&lt;&#x2F;li&gt;
&lt;li&gt;NLP em portugues clinico dermatologico. 80k+ dermatologistas no Brasil documentando em texto livre sem nenhum modelo treinado pra esse dominio.&lt;&#x2F;li&gt;
&lt;li&gt;dado de procedimento estetico nao-cirurgico (filler, toxina botulinica, laser) com follow-up. segmento de maior crescimento global, zero dataset.&lt;&#x2F;li&gt;
&lt;li&gt;dermatologia pediatrica em escala. crianca quase ausente dos datasets existentes, morfologia de lesao difere muito de adulto.&lt;&#x2F;li&gt;
&lt;li&gt;dataset de teledermatologia real-world (foto de smartphone, nao dermoscopia profissional) com ground truth histopatologico. gap entre qualidade de imagem de pesquisa e realidade clinica.&lt;&#x2F;li&gt;
&lt;li&gt;dado de interacao medicamentosa em dermatologia com outcome visual. efeito colateral cutaneo de droga e documentado textualmente mas sem imaging pareado.&lt;&#x2F;li&gt;
&lt;li&gt;dataset de cicatrizacao&#x2F;wound healing com time-series de imagem. ferida cronica (ulcera diabetica, venosa) sem tracking visual padronizado.&lt;&#x2F;li&gt;
&lt;li&gt;EHR psiquiatrico em lingua nao-inglesa com NLP treinado. PsyRoBERTa e dinamarques, MentalBERT e ingles, zero pra espanhol&#x2F;portugues&#x2F;hindi&#x2F;mandarim clinico.&lt;&#x2F;li&gt;
&lt;li&gt;saude mental, dado de terapia longitudinal com outcome validado (nao social media). Reddit&#x2F;Twitter como proxy de saude mental e cientificamente fragil.&lt;&#x2F;li&gt;
&lt;li&gt;genomica mais fenotipo dermatologico para populacao sub-representada (africana, indigena, mestica). GWAS dermatologico e 90%+ europeu.&lt;&#x2F;li&gt;
&lt;li&gt;dado de adesao a tratamento dermatologico com outcome visual. paciente comeca tratamento, abandona, piora: nenhum dataset captura esse ciclo.&lt;&#x2F;li&gt;
&lt;li&gt;dataset de reacao adversa cutanea a cosmetico com composicao quimica linkada. toxicovigilancia cosmetica sem dado visual em escala.&lt;&#x2F;li&gt;
&lt;li&gt;integracao de dado ambiental (UV, poluicao, umidade) com incidencia dermatologica geolocalizada. epidemiologia dermatologica ambiental sem dataset estruturado.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;os-mesmos-gaps-por-dificuldade-de-execucao-mais-facil-primeiro&quot;&gt;os mesmos gaps por dificuldade de execucao, mais facil primeiro&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;NLP em portugues clinico dermatologico. 6-12 meses com parceria institucional, o corpus de notas ja existe em hospital brasileiro, falta estruturar e treinar.&lt;&#x2F;li&gt;
&lt;li&gt;dermatologia mais saude mental (comorbidade DLQI mais PHQ-9 mais imagem). 12-24 meses, questionario validado ja existe, basta aplicar em coorte dermatologica existente.&lt;&#x2F;li&gt;
&lt;li&gt;dataset de teledermatologia real-world (foto smartphone mais ground truth). 12-18 meses, app de teledermatologia ja coleta essa foto, falta ground truth histopatologico.&lt;&#x2F;li&gt;
&lt;li&gt;dado de procedimento estetico nao-cirurgico com follow-up. 12-18 meses, clinica de estetica tem foto antes&#x2F;depois em volume, falta padronizacao e consentimento.&lt;&#x2F;li&gt;
&lt;li&gt;dataset padronizado de estetica antes&#x2F;depois com outcome measure. 12-24 meses, requer acordo com rede de clinica mas o dado bruto existe em gaveta.&lt;&#x2F;li&gt;
&lt;li&gt;saude mental, dado de terapia longitudinal com outcome validado. 18-24 meses, plataforma de terapia online (BetterHelp, Zenklub) tem o dado, falta acesso pra pesquisa.&lt;&#x2F;li&gt;
&lt;li&gt;dado de adesao a tratamento dermatologico com outcome visual. 18-24 meses, possivel em setting de clinical trial, requer protocolo prospectivo.&lt;&#x2F;li&gt;
&lt;li&gt;dataset de cicatrizacao&#x2F;wound healing time-series. 18-24 meses, clinica de wound care ja fotografa rotineiramente, falta padronizacao e estruturacao.&lt;&#x2F;li&gt;
&lt;li&gt;EHR psiquiatrico em lingua nao-inglesa com NLP. 12-36 meses conforme o idioma, hospital psiquiatrico publico tem volume de notas, a barreira e regulatoria.&lt;&#x2F;li&gt;
&lt;li&gt;dado de reacao adversa cutanea a cosmetico com composicao quimica. 24 meses, ANVISA&#x2F;FDA tem report mas sem imagem, requer coleta prospectiva.&lt;&#x2F;li&gt;
&lt;li&gt;integracao dado ambiental mais incidencia dermatologica geolocalizada. 24-36 meses, dado ambiental e publico (NASA, INPE), falta linkagem com registro dermatologico.&lt;&#x2F;li&gt;
&lt;li&gt;dermatologia pediatrica em escala. 24-36 meses, barreira etica de consentimento parental, IRB&#x2F;CEP mais restritivo pra menor.&lt;&#x2F;li&gt;
&lt;li&gt;dado de interacao medicamentosa com outcome visual. 24-36 meses, requer pharmacovigilance prospectiva com imaging, multi-institucional.&lt;&#x2F;li&gt;
&lt;li&gt;dataset EHR multi-center fora do eixo EUA&#x2F;Europa. 2-4 anos, requer coordenacao entre varios paises com regulacao de dado diferente.&lt;&#x2F;li&gt;
&lt;li&gt;diversidade Fitzpatrick IV-VI em escala (&amp;gt;50k imagens). 2-5 anos, requer infraestrutura de digitalizacao em regiao que nao tem, funding dedicado.&lt;&#x2F;li&gt;
&lt;li&gt;genomica mais fenotipo dermatologico para populacao sub-representada. 3-5 anos, requer sequenciamento mais phenotyping mais consentimento em populacao vulneravel.&lt;&#x2F;li&gt;
&lt;li&gt;longitudinal, lesao -&amp;gt; evolucao -&amp;gt; outcome. 3-7 anos pela natureza temporal, attrition de paciente, custo de follow-up.&lt;&#x2F;li&gt;
&lt;li&gt;dermatologia para tons asiaticos em escala. 3-5 anos, barreira regulatoria chinesa de exportacao de dado, infraestrutura indiana precaria.&lt;&#x2F;li&gt;
&lt;li&gt;WSI dermatologico aberto &amp;gt;10k laminas. 3-5 anos, investimento de 5-20M USD em equipamento mais anotacao, ninguem financiou em formato publico.&lt;&#x2F;li&gt;
&lt;li&gt;multimodal, dermoscopia mais histopatologia mais genomica linkados. 5-10 anos, requer integracao de 3+ silos hospitalares que operam de forma completamente independente, o custo de sequenciamento mais digitalizacao mais imaging por paciente deixa o custo por sample altissimo.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;parametros-e-condicoes-de-pele-detectaveis&quot;&gt;parametros e condicoes de pele detectaveis&lt;&#x2F;h2&gt;
&lt;p&gt;consolidacao dos parametros de analise de pele que apareceram nos equipamentos profissionais, organizados por categoria clinica com nota de implementacao. o que e detectavel, por qual metodo, e o que da pra fazer com hardware Apple.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;condicoes-pigmentares&quot;&gt;condicoes pigmentares&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;manchas-spots&quot;&gt;manchas, spots&lt;&#x2F;h4&gt;
&lt;p&gt;lesao pigmentar focal: sarda (efelide), lentigo solar, mancha senil (lentigo senil), nevo melanocitico. nos equipamentos: captura multi-espectral (RGB mais CPL mais UV) com algoritmo de segmentacao. implementacao: modelo de deteccao de objeto (YOLO-style ou segmentacao de instancia) treinado em dataset dermatologico (ISIC, DermNet, HAM10000). CoreML suporta as duas arquiteturas. output desejado: bounding box, mascara, classificacao por tipo, score de confianca.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pigmentacao-geral&quot;&gt;pigmentacao geral&lt;&#x2F;h4&gt;
&lt;p&gt;distribuicao total de melanina na face. diferente de mancha, que e focal, a pigmentacao geral avalia uniformidade e distribuicao. implementacao: analise no espaco LAB, mapa de intensidade do canal L* (luminancia) e b* (eixo amarelo-azul).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;hiperpigmentacao&quot;&gt;hiperpigmentacao&lt;&#x2F;h4&gt;
&lt;p&gt;excesso de pigmento em area especifica. inclui melasma, PIH (hiperpigmentacao pos-inflamatoria), mascara gravidica. implementacao: classificacao binaria pixel-wise (normal vs hiperpigmentado) ou segmentacao semantica com classe hiperpigmentacao. o dado de treino tem que incluir diversidade de fototipo Fitzpatrick I a VI.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;brown-zone-melanina-profunda&quot;&gt;brown zone, melanina profunda&lt;&#x2F;h4&gt;
&lt;p&gt;pigmentacao dermica profunda que nao aparece em RGB. revelada por CPL nos equipamentos. sem CPL: modelo de estimativa treinado em pares RGB&#x2F;CPL, precisao inferior ao CPL real mas util como screening. com CPL (filtro clip-on): processamento de imagem direto.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dano-solar-oculto-uv-spots&quot;&gt;dano solar oculto, UV spots&lt;&#x2F;h4&gt;
&lt;p&gt;alteracao de pigmento pre-clinica de exposicao UV acumulada, visivel so sob UV. sem UV fisico, nao e detectavel direto. possivel: modelo preditivo por fator de risco (fototipo, idade, exposicao solar reportada) mais mancha visivel como proxy.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;condicoes-de-textura&quot;&gt;condicoes de textura&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;rugas-wrinkles&quot;&gt;rugas, wrinkles&lt;&#x2F;h4&gt;
&lt;p&gt;linha fina e sulco profundo. classificacao tipica: linha fina (crow’s feet, periorbital), sulco moderado (nasolabial), ruga profunda (frontal). implementacao: segmentacao semantica especializada. grading de severidade (escala de Glogau ou similar) por classificacao. o modelo tem que distinguir ruga de expressao (dinamica) de ruga estatica, idealmente com captura em face neutra.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;poros&quot;&gt;poros&lt;&#x2F;h4&gt;
&lt;p&gt;abertura folicular dilatada, predominante na zona T (testa, nariz, queixo). implementacao: segmentacao em crop de alta resolucao. a resolucao minima util pra deteccao de poro fica em torno de 20 pixels por poro, o que exige crop region com magnificacao digital ou camera de alta resolucao. iPhone 48MP da conta de crop da zona T.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;textura-geral&quot;&gt;textura geral&lt;&#x2F;h4&gt;
&lt;p&gt;avalia suavidade, rugosidade, uniformidade da superficie. implementacao: metrica de textura computacional (variancia local, entropia, LBP, local binary patterns) extraida de imagem em alta resolucao. pode ser output numerico (score de textura) ou mapa espacial.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;condicoes-inflamatorias-e-vasculares&quot;&gt;condicoes inflamatorias e vasculares&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;sensibilidade-vermelhidao-difusa&quot;&gt;sensibilidade, vermelhidao difusa&lt;&#x2F;h4&gt;
&lt;p&gt;pele sensivel, rosacea, irritacao. caracterizada por vermelhidao difusa nao focal. implementacao: segmentacao de area vermelha com threshold no canal a* (LAB) ou canal R (RGB). classificacao: pele normal vs sensivel vs rosacea.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;red-area-inflamacao-focal&quot;&gt;red area, inflamacao focal&lt;&#x2F;h4&gt;
&lt;p&gt;eritema localizado, telangiectasia (vaso visivel), inflamacao perilesional. implementacao: deteccao de componente vermelho conectado mais classificacao de padrao (focal vs difuso vs linear&#x2F;vascular).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;acne-e-inflamacao&quot;&gt;acne e inflamacao&lt;&#x2F;h4&gt;
&lt;p&gt;acne comedonal (cravo), acne inflamatoria (papula, pustula), acne cistica. implementacao: deteccao de objeto multi-classe (comedao aberto, comedao fechado, papula, pustula, nodulo, cisto). dataset disponivel: ACNE04, dataset IIT Delhi.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;porfirinas-atividade-bacteriana&quot;&gt;porfirinas, atividade bacteriana&lt;&#x2F;h4&gt;
&lt;p&gt;presenca de Propionibacterium acnes detectada por fluorescencia UV. requer UV fisico (365-405nm), nao simulavel computacionalmente. sem UV: acne visivel como proxy de atividade bacteriana.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;classificacoes-gerais&quot;&gt;classificacoes gerais&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;tipo-de-pele&quot;&gt;tipo de pele&lt;&#x2F;h4&gt;
&lt;p&gt;classificacao em sistema, por exemplo Fitzpatrick pra fototipo, Baumann pro tipo funcional (oleosa&#x2F;seca, sensivel&#x2F;resistente, pigmentada&#x2F;nao-pigmentada, firme&#x2F;enrugada). implementacao: questionario mais analise de imagem combinados. o questionario captura o subjetivo (sensacao de oleosidade, historico de queimadura), a imagem complementa com dado objetivo (brilho especular pra oleosidade, vermelhidao pra sensibilidade).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;grading-de-envelhecimento&quot;&gt;grading de envelhecimento&lt;&#x2F;h4&gt;
&lt;p&gt;escala de severidade de envelhecimento cutaneo (Glogau, Fitzpatrick-Goldman, ou proprietaria). implementacao: regressao ou classificacao ordinal treinada em imagem facial rotulada por dermatologista. output: score numerico mais categoria (leve, moderado, severo, muito severo).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tom-e-uniformidade&quot;&gt;tom e uniformidade&lt;&#x2F;h4&gt;
&lt;p&gt;avalia uniformidade de cor (tom) da face. area de discromia, tom desigual, zona de sombra. implementacao: mapa de desvio do tom medio. calcula o tom medio da face, gera mapa de diferenca pixel-wise, destaca area com desvio acima do threshold.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;simulacoes-preditivas&quot;&gt;simulacoes preditivas&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;simulacao-de-envelhecimento&quot;&gt;simulacao de envelhecimento&lt;&#x2F;h4&gt;
&lt;p&gt;projecao visual de como a face pode envelhecer ao longo de anos. percepcao de valor alta pelo paciente, usada como motivacao pra tratamento preventivo. implementacao: modelo generativo (GAN ou diffusion) de aging facial. modelos existentes: SAM (style-based age manipulation), FADING. conversao pra CoreML via coremltools. tamanho estimado: 50 a 200MB conforme a arquitetura. rodavel na ANE (Apple Neural Engine) dos chips A15+.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;simulacao-de-evolucao-de-manchas&quot;&gt;simulacao de evolucao de manchas&lt;&#x2F;h4&gt;
&lt;p&gt;projecao de como a mancha pigmentar pode progredir. implementacao: pode ser subproduto do modelo de aging, com output especifico pro canal de pigmentacao. alternativa: modelo separado mais leve focado em textura de pigmento.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;modos-de-imagem-para-analise-facial&quot;&gt;modos de imagem para analise facial&lt;&#x2F;h2&gt;
&lt;p&gt;consolidacao dos modos de captura e processamento de imagem que apareceram nos equipamentos profissionais de analise facial. os equipamentos rodam de 8 a 15 modos simultaneos, com resolucoes de 20MP a 42MP full-face. dois grupos: espectro de iluminacao (depende de hardware de captura) e processamento (derivado por computacao a partir das capturas).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;espectros-de-iluminacao&quot;&gt;espectros de iluminacao&lt;&#x2F;h3&gt;
&lt;p&gt;dependem de hardware de captura. e aqui que mora a maior parte da inviabilidade, porque a camera Apple so entrega RGB nativo.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;rgb-luz-visivel&quot;&gt;RGB, luz visivel&lt;&#x2F;h4&gt;
&lt;p&gt;captura padrao em cor natural. base pra todo o resto. presente em 100% dos equipamentos. nativo em qualquer camera Apple, sem restricao.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;cpl-cross-polarized-light&quot;&gt;CPL, cross-polarized light&lt;&#x2F;h4&gt;
&lt;p&gt;elimina a reflexao especular da superficie e revela pigmentacao subsuperficial na derme. e o modo pra ver melanina profunda, vaso sanguineo, condicao abaixo da epiderme que nao aparece no RGB. requer filtro polarizador fisico. existe clip-on de filtro pra iPhone, custo baixo. alternativa pior: modelo CoreML treinado em pares RGB&#x2F;CPL pra estimar CPL a partir de RGB, com precisao reduzida.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;ppl-parallel-balanced-polarized-light&quot;&gt;PPL, parallel&#x2F;balanced polarized light&lt;&#x2F;h4&gt;
&lt;p&gt;enfatiza textura superficial da epiderme. complemento do CPL: onde CPL revela profundidade, PPL revela superficie. mesma situacao do CPL, requer filtro polarizador.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;uv-uva-ultravioleta&quot;&gt;UV&#x2F;UVA, ultravioleta&lt;&#x2F;h4&gt;
&lt;p&gt;revela dano solar invisivel a olho nu. penetra superficialmente e destaca alteracao de pigmento de exposicao solar acumulada. requer fonte UV em 365nm e sensor sensivel a UV. nao replicavel na camera Apple padrao. possivel com acessorio USB-C dedicado.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;nir-near-infrared&quot;&gt;NIR, near-infrared&lt;&#x2F;h4&gt;
&lt;p&gt;penetra camadas mais profundas da derme, revela condicao vascular e estrutural profunda que luz visivel e UV nao alcancam. requer sensor IR dedicado. a TrueDepth do iPhone emite IR pro Face ID mas nao expoe o raw da imagem IR via API publica. da pra acessar por framework privado, nao recomendo pra producao.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;lampada-de-wood&quot;&gt;lampada de Wood&lt;&#x2F;h4&gt;
&lt;p&gt;UV em 365nm que provoca fluorescencia em certas substancias da pele. detecta infeccao fungica, bacteriana, alteracao de pigmento. padrao em dermatologia clinica. requer hardware UV dedicado. alguns equipamentos simulam o efeito por processamento de imagem UV, mas a fluorescencia real exige excitacao fisica UV.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;modos-de-processamento&quot;&gt;modos de processamento&lt;&#x2F;h3&gt;
&lt;p&gt;derivados por computacao a partir das capturas acima. todos candidatos a implementacao via CoreML, Core Image, vImage.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;sensitivity-sensitive-area&quot;&gt;sensitivity, sensitive area&lt;&#x2F;h4&gt;
&lt;p&gt;mapeia area de vermelhidao difusa, sinal de pele sensivel, rosacea, irritacao. tipicamente derivado de analise do canal vermelho com segmentacao por intensidade e distribuicao espacial. implementacao: segmentacao semantica CoreML treinada em dataset de pele sensivel, ou isolamento do canal R com thresholding adaptativo via Core Image.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;red-area-red-zone&quot;&gt;red area, red zone&lt;&#x2F;h4&gt;
&lt;p&gt;parecido com sensitivity mas focado em inflamacao localizada e vascularizacao visivel, telangiectasia, eritema. a diferenca tecnica: sensitivity mapeia vermelhidao difusa, red area mapeia vermelhidao focal. implementacao: isolamento do canal vermelho, deteccao de componentes conectados, classificacao de intensidade.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;heatmap&quot;&gt;heatmap&lt;&#x2F;h4&gt;
&lt;p&gt;visualizacao em gradiente de cor (falso-color) mostrando distribuicao de intensidade. pode representar temperatura (se houver IR) ou intensidade cromatica (derivado de RGB). nos equipamentos analisados parece derivado de intensidade de cor, nao de temperatura real. implementacao trivial via Core Image: grayscale, aplicar color lookup table com gradiente termico.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;spots-manchas&quot;&gt;spots, manchas&lt;&#x2F;h4&gt;
&lt;p&gt;detecta e segmenta mancha pigmentar: sarda, lentigo solar, melasma, mancha senil. precisa de alta resolucao pra pegar mancha pequena. implementacao: modelo de deteccao de objeto ou segmentacao de instancia (CoreML), com dataset rotulado por tipo de mancha.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;spots-simulation&quot;&gt;spots simulation&lt;&#x2F;h4&gt;
&lt;p&gt;projecao computacional de como a mancha pode evoluir no tempo sem tratamento. valor percebido alto pelo paciente. implementacao: modelo generativo (GAN ou diffusion) de aging focado em pigmento, rodavel local via CoreML com modelos otimizados pra ANE.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;brown-brown-zone&quot;&gt;brown, brown zone&lt;&#x2F;h4&gt;
&lt;p&gt;isola pigmentacao melanica especifica. diferente de spots, que detecta mancha individual, brown mapeia a distribuicao total de melanina. implementacao: analise de cor no espaco LAB (canal b* pra amarelo-azul, canal a* pra vermelho-verde) via Core Image. thresholding em LAB e mais robusto que RGB pra deteccao de melanina.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;hyperpigmentation&quot;&gt;hyperpigmentation&lt;&#x2F;h4&gt;
&lt;p&gt;subconjunto de pigmentacao, area de pigmento excessivo. separado de pigmentacao geral, o que sugere valor clinico em distinguir pigmentacao normal de hiperpigmentacao patologica. implementacao: classificacao binaria (normal vs hiperpigmentado) por pixel ou por regiao, treinada em dado clinico rotulado.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wrinkles-rugas&quot;&gt;wrinkles, rugas&lt;&#x2F;h4&gt;
&lt;p&gt;detecta e mapeia linha fina e ruga profunda. os equipamentos usam alta resolucao mais contraste pra evidenciar textura. implementacao: deteccao de borda (Canny, Laplacian) mais segmentacao semantica especializada em linha de expressao. o Vision framework tem VNDetectFaceLandmarksRequest, retorna contorno facial mas nao e granular pra ruga individual.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;wrinkles-simulation&quot;&gt;wrinkles simulation&lt;&#x2F;h4&gt;
&lt;p&gt;projecao de evolucao de ruga no tempo. complemento do spots simulation. implementacao: modelo generativo de aging facial, pode compartilhar arquitetura com spots simulation, com output separado pra pigmento e textura.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;porphyrin-porfirinas&quot;&gt;porphyrin, porfirinas&lt;&#x2F;h4&gt;
&lt;p&gt;detecta atividade bacteriana (Propionibacterium acnes) por fluorescencia de porfirina sob UV. a porfirina emite fluorescencia vermelha&#x2F;laranja quando excitada por UV 365-405nm. usado pra avaliar acne e atividade de glandula sebacea. requer UV real pra excitacao. nao simulavel computacionalmente a partir de RGB.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;pores-poros&quot;&gt;pores, poros&lt;&#x2F;h4&gt;
&lt;p&gt;mapeia poro dilatado. requer alta resolucao e bom contraste. tipicamente analisado em crop regional (nariz, bochecha, testa), nao full-face. implementacao: segmentacao em crop de alta resolucao. a camera de 48MP do iPhone 15 Pro+ tem resolucao adequada pra deteccao de poro em crop regional.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;monochrome&quot;&gt;monochrome&lt;&#x2F;h4&gt;
&lt;p&gt;conversao pra escala de cinza pra analisar contraste e textura sem influencia de cor. trivial: desaturacao via Core Image (CIColorControls).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;green-channel-canal-verde&quot;&gt;green channel, canal verde&lt;&#x2F;h4&gt;
&lt;p&gt;isola o canal verde do RGB. o verde e o mais sensivel a hemoglobina e vascularizacao, da pra ver padrao vascular superficial. trivial via Core Image: extrai o canal G, renderiza em grayscale ou falso-color verde.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;uv-spots&quot;&gt;UV spots&lt;&#x2F;h4&gt;
&lt;p&gt;dano solar oculto revelado por UV. mostra pigmentacao que ainda nao aparece em luz normal mas ja existe na pele (dano acumulado pre-clinico). requer UV real, nao derivavel de RGB. da pra estimar com modelo treinado em pares UV&#x2F;RGB, com precisao limitada.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;calibracao-de-cor&quot;&gt;calibracao de cor&lt;&#x2F;h3&gt;
&lt;p&gt;equipamento de tier superior usa calibracao com 48 cores pra garantir consistencia entre sessoes e ambientes de iluminacao. um display vertical 4K serve de referencia.&lt;&#x2F;p&gt;
&lt;p&gt;pro dermML: fotografar um color checker card (X-Rite ColorChecker ou similar) na mesma sessao de captura. usar Core Image pra computar a matriz de transformacao de cor que normaliza a captura pra um espaco de referencia. assim a comparacao antes&#x2F;depois vale mesmo com iluminacao diferente entre sessoes.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resolucoes-identificadas&quot;&gt;resolucoes identificadas&lt;&#x2F;h3&gt;
&lt;p&gt;os equipamentos operam em 3 tiers:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;tier&lt;&#x2F;th&gt;&lt;th&gt;resolucao&lt;&#x2F;th&gt;&lt;th&gt;uso&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;1&lt;&#x2F;td&gt;&lt;td&gt;42MP full-face&lt;&#x2F;td&gt;&lt;td&gt;topo de linha 3D&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;20MP full-face&lt;&#x2F;td&gt;&lt;td&gt;analisador 2D multi-espectral&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;3&lt;&#x2F;td&gt;&lt;td&gt;1.3MP&lt;&#x2F;td&gt;&lt;td&gt;microscopia capilar, magnificacao 100-200x&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;camera iPhone 15 Pro+: 48MP no sensor main, 12MP no ultra-wide&#x2F;macro. a resolucao nativa e competitiva ou superior ao tier 1 e 2, mas sem controle de iluminacao multi-espectral integrado. essa e a fronteira: o sensor da conta, o que falta e o espectro.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;modelagem-3d-facial&quot;&gt;modelagem 3D facial&lt;&#x2F;h2&gt;
&lt;p&gt;capacidade de captura e reconstrucao 3D facial dos equipamentos profissionais, e o que da pra alcancar com hardware Apple. resumo da fronteira: a precisao submilimetrica dos equipamentos dedicados e inatingivel via Apple, mas pro uso estetico o ARKit&#x2F;LiDAR resolve.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;capacidades-dos-equipamentos&quot;&gt;capacidades dos equipamentos&lt;&#x2F;h3&gt;
&lt;p&gt;reconstrucao 3D de alta precisao: resolucao 42MP full-face, precisao geometrica 0.2mm (submilimetrica). aplicacao em avaliacao estetica tridimensional, planejamento cirurgico, tracking de resultado de procedimento.&lt;&#x2F;p&gt;
&lt;p&gt;visualizacao 3D de textura: renderiza a superficie da pele com textura de alta resolucao mapeada. rotacao e zoom interativo pra examinar varios angulos. presente no tier intermediario (20MP) com reconstrucao 3D parcial.&lt;&#x2F;p&gt;
&lt;p&gt;comparacao 3D: comparacao volumetrica de captura em momentos diferentes. quantifica alteracao de volume (preenchimento, perda de gordura facial, edema).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;implementacao-via-apple&quot;&gt;implementacao via Apple&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;arkit-face-tracking-truedepth&quot;&gt;ARKit face tracking, TrueDepth&lt;&#x2F;h4&gt;
&lt;p&gt;disponivel em iPhone com Face ID (iPhone X+). retorna face mesh com 1220 vertices e blend shapes em tempo real. precisao geometrica inferior a 0.2mm, estimada em 1 a 3mm pro contorno facial. limitacao: so funciona na camera frontal (TrueDepth), nao na traseira, exceto iPhone com LiDAR.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;lidar-scanner-ipad-pro-iphone-pro&quot;&gt;LiDAR scanner, iPad Pro, iPhone Pro&lt;&#x2F;h4&gt;
&lt;p&gt;disponivel em iPad Pro (2020+) e iPhone 12 Pro+. retorna depth map e mesh 3D via ARKit. precisao 1 a 5mm conforme a distancia. vantagem: funciona na camera traseira com controle de iluminacao. uso: captura 3D facial com iluminacao controlada mais textura de alta resolucao pela camera 48MP em simultaneo.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;scenekit-realitykit-pra-renderizacao&quot;&gt;SceneKit &#x2F; RealityKit pra renderizacao&lt;&#x2F;h4&gt;
&lt;p&gt;renderizacao interativa do mesh 3D capturado com textura mapeada. rotacao, zoom, medicao interativa. export em USDZ (formato nativo Apple) pra compartilhamento e visualizacao em AR.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;photogrammetry-api-object-capture&quot;&gt;Photogrammetry API, Object Capture&lt;&#x2F;h4&gt;
&lt;p&gt;disponivel desde macOS Monterey &#x2F; iOS 17. reconstroi objeto 3D a partir de varias fotos 2D. precisao depende do numero de foto e da angulacao. uso potencial: captura 3D facial a partir de sequencia de foto (video de rotacao da face). nao ideal pro uso clinico pela variabilidade, mas util pra tracking longitudinal.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;consideracoes-para-dermml&quot;&gt;consideracoes para dermML&lt;&#x2F;h3&gt;
&lt;p&gt;a precisao de 0.2mm dos equipamentos dedicados e inatingivel via hardware Apple atual. pro uso clinico (planejamento cirurgico), precisa de hardware dedicado. pro uso estetico (tracking de envelhecimento, avaliacao de simetria, visualizacao pro paciente), a precisao do ARKit&#x2F;LiDAR e suficiente.&lt;&#x2F;p&gt;
&lt;p&gt;o diferencial do dermML seria juntar a captura 3D (mesmo com precisao inferior) com analise de textura via CoreML. nenhum equipamento analisado faz analise de condicao de pele direto no modelo 3D, eles capturam 3D e analisam textura em 2D separado. o dermML podia mapear o resultado da analise 2D (mancha, ruga, poro) direto sobre o mesh 3D, numa visualizacao integrada que nenhum deles tem.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;otimizacao-de-compressao-av1-por-ordenacao-visual-de-frames&quot;&gt;otimizacao de compressao AV1 por ordenacao visual de frames&lt;&#x2F;h2&gt;
&lt;p&gt;proposta de otimizacao pro sistema AV1-backed dataset do dermML: ordenar a imagem por similaridade visual antes do encoding pra maximizar a compressao inter-frame. autor Brenner Cruvinel, Hoff Research LTDA. fevereiro 2026, proposta, nao implementado. esse e o sistema base que virou o spin-off [[truw]], onde o truque do AV1 foi generalizado e tambem onde foi falsificado como index exato.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;1-problema-atual&quot;&gt;1. problema atual&lt;&#x2F;h3&gt;
&lt;p&gt;no encoding atual a imagem e empacotada como frame AV1 na ordem do filesystem (ordem alfabetica do nome de arquivo). isso quer dizer que frame adjacente no video pode ser visualmente muito diferente:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Frame 0: ISIC_0024306.jpg  (melanoma escuro, pele clara)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Frame 1: ISIC_0024307.jpg  (nevo benigno, pele escura)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Frame 2: ISIC_0024308.jpg  (dermatofibroma, pele media)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;o codec AV1 usa predicao inter-frame: pra codificar o frame N ele calcula o delta em relacao ao frame N-1 (ou outro frame de referencia). se o frame adjacente e visualmente distinto, o delta e grande e a compressao inter-frame se perde.&lt;&#x2F;p&gt;
&lt;p&gt;o resultado atual (~30x de compressao) vem quase inteiro da eficiencia intra-frame do AV1 (compressao dentro de cada imagem). a compressao inter-frame esta subutilizada.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;2-proposta-ordenacao-por-similaridade-visual&quot;&gt;2. proposta, ordenacao por similaridade visual&lt;&#x2F;h3&gt;
&lt;p&gt;antes de encodar a imagem como video, ordenar de forma que frame adjacente seja maximamente similar. assim o delta inter-frame fica minimo e o AV1 comprime muito mais agressivo.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;2-1-metodo-tsp-nos-embeddings-dermlip&quot;&gt;2.1 metodo, TSP nos embeddings DermLIP&lt;&#x2F;h4&gt;
&lt;p&gt;os embeddings DermLIP (512 dimensoes, L2-normalizados) ja existem no pipeline de indexacao. a ordenacao otima e equivalente ao travelling salesman problem (TSP) no espaco de embedding: achar a sequencia que minimiza a distancia total entre frame consecutivo. pra 58k pontos o TSP exato e intratavel. heuristica viavel:&lt;&#x2F;p&gt;
&lt;p&gt;nearest neighbor greedy (mais simples):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; numpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; sklearn&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;metrics&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;pairwise&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; cosine_distances&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; sort_by_visual_similarity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; image_paths&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    Ordena imagens por similaridade visual usando nearest-neighbor greedy.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    embeddings: np.array shape (N, 512), L2-normalized&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    image_paths: list of str, paths das imagens&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    Retorna: indices ordenados&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    N&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    visited&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; set&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    order&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    visited&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    order&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; _&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dists&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; cosine_distances&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dists&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;visited&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; float&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;inf&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        nearest&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;argmin&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dists&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        visited&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nearest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        order&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;nearest&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; nearest&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;complexidade O(N^2) em distancia. pra 58k imagens com embedding 512-dim isso leva ~10-30 minutos em CPU. aceitavel como processo offline.&lt;&#x2F;p&gt;
&lt;p&gt;FAISS accelerated (recomendado pra dataset grande):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; faiss&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; numpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; sort_by_similarity_faiss&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; image_paths&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    Versao acelerada usando FAISS para nearest-neighbor.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    Usa busca aproximada para datasets &amp;gt; 50k.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dim&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; embeddings&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;shape&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; faiss&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;IndexFlatIP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dim&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; Inner product = cosine em vetores normalizados&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    visited&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;zeros&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dtype&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    order&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;zeros&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dtype&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;int64&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    visited&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B58900, #B58900);&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    order&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; step&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; N&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        k&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;step&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; +&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 100&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; N&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; Buscar mais que o necessario para ter margem&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        scores&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;search&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; k&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; visited&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;idx&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; idx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                visited&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B58900, #B58900);&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                order&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;step&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; current&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;                break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; order&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tolist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;clustering mais sort (alternativa hierarquica):&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; sklearn&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;cluster&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; KMeans&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; numpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; sort_by_clustering&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; n_clusters&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    Agrupa imagens em clusters, ordena clusters por centroide,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    ordena imagens dentro de cada cluster por distancia ao centroide.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    Resultado: transicoes suaves entre grupos visuais.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    kmeans&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; KMeans&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n_clusters&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;n_clusters&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; random_state&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;42&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    labels&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; kmeans&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fit_predict&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    centroids&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; kmeans&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;cluster_centers_&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cluster_order&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sort_by_visual_similarity&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;centroids&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; list&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;n_clusters&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    final_order&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; cluster_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; cluster_order&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        mask&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; labels&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span&gt; cluster_idx&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        indices&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;where&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;mask&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        dists&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;linalg&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;norm&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;indices&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span&gt; centroids&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;cluster_idx&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; axis&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        sorted_indices&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;argsort&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dists&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        final_order&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;extend&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sorted_indices&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;tolist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; final_order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;2-2-pipeline-completo-proposto&quot;&gt;2.2 pipeline completo proposto&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;1. carregar todas as imagens do dataset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;2. gerar embeddings DermLIP por imagem (ja existe no pipeline atual)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;3. ordenar indices por similaridade visual (nearest-neighbor greedy ou clustering)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;4. gerar filelist.txt com a imagem na ordem otimizada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;5. ffmpeg encode AV1 com a lista ordenada&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;6. indexar frames com mapeamento: frame_idx -&amp;gt; (imagem original, posicao no dataset)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;script proposto, &lt;code&gt;sort_and_encode.py&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;!&#x2F;usr&#x2F;bin&#x2F;env python3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Ordena imagens por similaridade visual e encoda como AV1.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Maximiza compressao inter-frame.&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; numpy&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; faiss&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; pathlib&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; Path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; subprocess&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;import&lt;&#x2F;span&gt;&lt;span&gt; tempfile&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; load_embeddings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index_path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; db_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Carrega embeddings e metadata existentes.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; faiss&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;read_index&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;str&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    embeddings&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; faiss&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;rev_swig_ptr&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;get_xb&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ntotal&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; *&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;d&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    )&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;reshape&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;ntotal&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;d&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;copy&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    import&lt;&#x2F;span&gt;&lt;span&gt; sqlite3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    conn&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sqlite3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;connect&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;str&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;db_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    conn&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;row_factory&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; sqlite3&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;Row&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    rows&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; conn&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;execute&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;SELECT * FROM frames ORDER BY idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;fetchall&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    metadata&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;dict&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;r&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; for&lt;&#x2F;span&gt;&lt;span&gt; r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; rows&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    conn&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;close&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; embeddings&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; metadata&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; greedy_nearest_neighbor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Ordena por nearest-neighbor greedy no espaco de embeddings.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    N&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; faiss&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;IndexFlatIP&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;shape&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;add&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    visited&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; np&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;zeros&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; dtype&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    order&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    visited&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B58900, #B58900);&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    order&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; step&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; N&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        scores&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; index&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;search&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;+&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; min&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;N&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 200&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; indices&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;            if&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; not&lt;&#x2F;span&gt;&lt;span&gt; visited&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;idx&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                current&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; int&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;idx&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                visited&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B58900, #B58900);&quot;&gt; True&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;                order&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;append&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;current&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;                break&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; order&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; generate_sorted_filelist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; order&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Gera filelist.txt na ordem otimizada para ffmpeg concat.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    with&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; open&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output_path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;w&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; as&lt;&#x2F;span&gt;&lt;span&gt; f&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;        for&lt;&#x2F;span&gt;&lt;span&gt; idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; order&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            meta&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; metadata&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span&gt;idx&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            image_path&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt; f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;datasets&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;meta&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;dataset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&#x2F;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;meta&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;original_image_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            f&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;write&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;file &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span&gt;image_path&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;\n&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    return&lt;&#x2F;span&gt;&lt;span&gt; output_path&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;def&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; encode_av1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;filelist_path&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; output_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Encoda video AV1 a partir da lista ordenada.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    cmd&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;ffmpeg&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-y&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;concat&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-safe&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; str&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;filelist_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-c:v&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;libsvtav1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-crf&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;30&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-pix_fmt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;yuv420p&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;        &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;-r&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;        str&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;output_path&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    subprocess&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;run&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;cmd&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; check&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#B58900, #B58900);&quot;&gt;True&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;if&lt;&#x2F;span&gt;&lt;span&gt; __name__&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; ==&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;__main__&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    INDEX_PATH&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Path&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;outputteste&#x2F;compressed&#x2F;video_embeddings.index&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    DB_PATH&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; Path&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;outputteste&#x2F;compressed&#x2F;video_metadata.db&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;[1&#x2F;4] Carregando embeddings...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    embeddings&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; metadata&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; load_embeddings&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;INDEX_PATH&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; DB_PATH&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;[2&#x2F;4] Ordenando &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;len&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; imagens por similaridade visual...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    order&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; greedy_nearest_neighbor&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;embeddings&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;[3&#x2F;4] Gerando filelist ordenada...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    filelist&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; generate_sorted_filelist&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;metadata&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; order&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;outputteste&#x2F;sorted_filelist.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;[4&#x2F;4] Encoding AV1 com ordem otimizada...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    encode_av1&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;filelist&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;outputteste&#x2F;compressed&#x2F;dataset_sorted_av1.mp4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;    print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;[OK] Encoding completo.&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;3-estimativa-de-ganho-de-compressao&quot;&gt;3. estimativa de ganho de compressao&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;3-1-raciocinio-teorico&quot;&gt;3.1 raciocinio teorico&lt;&#x2F;h4&gt;
&lt;p&gt;no encoding atual (ordem de filesystem) a maior parte da compressao vem do modo intra-frame do AV1. a inter-frame contribui pouco porque frame adjacente e imagem de paciente&#x2F;lesao completamente diferente.&lt;&#x2F;p&gt;
&lt;p&gt;com ordenacao por similaridade: frame adjacente tem background de pele similar (mesmo tom, iluminacao), lesao adjacente tem formato&#x2F;cor&#x2F;textura similar, o delta inter-frame fica dominado por pequena variacao local. em codec de video a eficiencia inter-frame tipicamente adiciona 2-5x de compressao sobre o modo intra-only pra conteudo com alta redundancia temporal.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-2-estimativa-conservadora&quot;&gt;3.2 estimativa conservadora&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;cenario&lt;&#x2F;th&gt;&lt;th&gt;compressao estimada&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;atual (ordem filesystem)&lt;&#x2F;td&gt;&lt;td&gt;~30x&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;com ordenacao por similaridade&lt;&#x2F;td&gt;&lt;td&gt;~50-80x&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;com ordenacao mais tuning de CRF&#x2F;GOP&lt;&#x2F;td&gt;&lt;td&gt;~60-100x&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;pro dataset completo: atual 52 GB -&amp;gt; ~1.7 GB, estimado com ordenacao 52 GB -&amp;gt; ~650 MB a 1.0 GB.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;3-3-como-validar&quot;&gt;3.3 como validar&lt;&#x2F;h4&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 1. encodar o mesmo dataset com e sem ordenacao&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;ffmpeg&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; filelist_original.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; dataset_unsorted.mp4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;ffmpeg&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; filelist_sorted.txt&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;   ...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; dataset_sorted.mp4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 2. comparar tamanhos&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;ls&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;lh&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; dataset_unsorted.mp4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; dataset_sorted.mp4&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 3. comparar qualidade (VMAF, PSNR, SSIM)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;ffmpeg&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; dataset_unsorted.mp4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;i&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; dataset_sorted.mp4&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;  -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;lavfi&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; libvmaf&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;f&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; null&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; -&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 4. verificar que a busca por similaridade funciona igual&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; (re-indexar o video sorted e comparar resultados de query)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;4-consideracoes-de-implementacao&quot;&gt;4. consideracoes de implementacao&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;4-1-mapeamento-frame-imagem-original&quot;&gt;4.1 mapeamento frame -&amp;gt; imagem original&lt;&#x2F;h4&gt;
&lt;p&gt;com a ordenacao, o frame_idx no video sorted nao corresponde mais ao indice original. o SQLite metadata precisa de uma coluna extra:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;sql&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;CREATE&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; TABLE&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; frames_sorted&lt;&#x2F;span&gt;&lt;span&gt; (&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;INTEGER&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt; PRIMARY KEY&lt;&#x2F;span&gt;&lt;span&gt;,        &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;--&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; indice no FAISS&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    sorted_frame_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;INTEGER&lt;&#x2F;span&gt;&lt;span&gt;,       &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;--&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; posicao no video sorted&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    video_file &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;TEXT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    original_frame_idx &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;INTEGER&lt;&#x2F;span&gt;&lt;span&gt;,     &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;--&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; posicao no video original&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    dataset &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;TEXT&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    original_image_id &lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#586E75, #93A1A1);font-weight: bold;&quot;&gt;TEXT&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;);&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;4-2-gop-structure&quot;&gt;4.2 GOP structure&lt;&#x2F;h4&gt;
&lt;p&gt;pra maximizar compressao inter-frame, configurar o GOP (group of pictures) do SVT-AV1:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;ffmpeg&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;c:v&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; libsvtav1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;  -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;svtav1-params&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;keyint=250:scd=0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;  ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;code&gt;keyint=250&lt;&#x2F;code&gt; poe keyframe a cada 250 frames (permite inter-prediction por trecho longo). &lt;code&gt;scd=0&lt;&#x2F;code&gt; desabilita scene change detection (nao quero keyframe extra quando a lesao muda). com GOP longo, o seek aleatorio pra um frame especifico exige decodar desde o keyframe anterior. pra thumbnail sob demanda o custo e ~10-100ms extra por seek. aceitavel.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;4-3-estrategias-de-ordenacao-alternativas&quot;&gt;4.3 estrategias de ordenacao alternativas&lt;&#x2F;h4&gt;
&lt;p&gt;Hilbert curve no espaco de embedding: projeta o embedding 512-dim numa curva de Hilbert 1-dim, preserva localidade espacial melhor que nearest-neighbor greedy, mais uniforme, evita cluster isolado.&lt;&#x2F;p&gt;
&lt;p&gt;spectral ordering: usa o segundo autovetor do Laplaciano do grafo de similaridade (Fiedler vector) pra achar a ordenacao que minimiza a soma total de diferenca entre vizinho. matematicamente otimo, mas O(N^2) em memoria pra matriz de afinidade.&lt;&#x2F;p&gt;
&lt;p&gt;hierarchical clustering (dendrogram traverse): constroi arvore hierarquica de cluster e percorre a folha em ordem, garante transicao suave em multiplas escalas.&lt;&#x2F;p&gt;
&lt;p&gt;pra uma primeira implementacao, nearest-neighbor greedy ou clustering mais sort dao conta e sao simples.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;5-potencial-como-publicacao-ou-ferramenta-open-source&quot;&gt;5. potencial como publicacao ou ferramenta open-source&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;5-1-contribuicao-original&quot;&gt;5.1 contribuicao original&lt;&#x2F;h4&gt;
&lt;p&gt;ate onde foi verificado (fevereiro 2026), nao existe publicacao ou ferramenta que combine: 1. codec de video (AV1) como formato de armazenamento de dataset de imagem, 2. ordenacao por similaridade visual pra maximizar compressao inter-frame, 3. indexacao de embedding por frame pra busca integrada, 4. benchmark comparativo sistematico de codec de video como formato de dataset.&lt;&#x2F;p&gt;
&lt;p&gt;cada elemento existe isolado: AV1 como compressor de imagem (AVIF), ordenacao por similaridade (TSP em embedding), FAISS pra busca, dataset empacotado (TFRecord, WebDataset). a combinacao desses elementos num pipeline integrado pra dataset medico e, ate onde verificado, original.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;5-2-formato-proposto-videodataset&quot;&gt;5.2 formato proposto, VideoDataset&lt;&#x2F;h4&gt;
&lt;p&gt;especificacao pra um formato de dataset baseado em video:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dataset.vds&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  data.mp4              # imagens como frames AV1 (ordenadas por similaridade)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  embeddings.index      # FAISS index (opcional, para busca)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  metadata.db           # SQLite: frame_idx -&amp;gt; metadados originais&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  manifest.json         # metadados do dataset (schema, contagem, versao, codec params)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;manifest.json:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;json&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;format&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;videodataset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;version&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;1.0&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;codec&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;av1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;encoder&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;libsvtav1&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;total_frames&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 58000&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;resolution&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;512x512&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;fps&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;crf&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 30&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;sorting&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;dermlip-nearest-neighbor&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;embedding_model&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;redlessone&#x2F;DermLIP_ViT-B-16&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;embedding_dim&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 512&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;original_size_gb&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 52.0&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;compressed_size_gb&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 0.65&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;compression_ratio&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 80&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;  &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;datasets&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;HAM10000&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;frames&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 10015&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;start_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 0&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;DermNet&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;frames&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 19446&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;start_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 10015&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    {&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;name&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;ISIC2019&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;frames&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 25331&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;start_idx&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 29461&lt;&#x2F;span&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;  ]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h4 id=&quot;5-3-possivel-titulo-de-paper&quot;&gt;5.3 possivel titulo de paper&lt;&#x2F;h4&gt;
&lt;p&gt;“VideoDataset: AV1 Video-Backed Compression for Medical Image Datasets with Integrated Similarity Search”. venue relevante: MICCAI (Medical Image Computing and Computer Assisted Intervention), ML4H (Machine Learning for Health), NeurIPS Datasets and Benchmarks Track, Nature Scientific Data, arXiv cs.CV &#x2F; cs.MM.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;5-4-pontos-fortes-para-review&quot;&gt;5.4 pontos fortes para review&lt;&#x2F;h4&gt;
&lt;p&gt;pratico: resolve um problema real de engenharia (distribuicao de dataset de 50+ GB). reprodutivel: usa ferramenta existente (ffmpeg, FAISS, DermLIP). benchmark rigoroso: 7 formatos comparados empiricamente. generalizavel: funciona pra qualquer dataset de imagem, nao so dermatologia. royalty-free: AV1 e codec aberto, sem licenciamento.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;lerobotdataset-v3-0-large-scale-datasets-in-lerobot&quot;&gt;LeRobotDataset v3.0, large-scale datasets in lerobot&lt;&#x2F;h2&gt;
&lt;p&gt;clipping de referencia. Hugging Face, 16 de setembro de 2025, autores Francesco Capuano, Michel Aractingi, Quentin Lhoest, Caroline Pascal, Pepijn Kooijmans, Jade Choghari, Remi Cadene, Simon Alibert, Adil Zouitine, Martino Russi, Steven Palma. fonte https:&#x2F;&#x2F;huggingface.co&#x2F;blog&#x2F;lerobot-datasets-v3 . relevante pro dermML como prior art de formato: o v3 empacota varios episodios num arquivo so com metadata relacional, e suporta streaming. o benchmark de codec esta em [[scaling-robotics-datasets-video-encoding]].&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resumo&quot;&gt;resumo&lt;&#x2F;h3&gt;
&lt;p&gt;o v2 guardava um episodio por arquivo, batendo no limite de file-system ao escalar pra milhoes de episodio. o v3 empacota varios episodios num arquivo so, usando metadata relacional pra recuperar a informacao no nivel do episodio individual. o formato novo suporta nativo o acesso em modo streaming, processando dataset grande on the fly. tem util de uma linha pra converter todo dataset do formato LeRobotDataset pro novo.&lt;&#x2F;p&gt;
&lt;p&gt;o LeRobotDataset e formato padronizado pras necessidades de robot learning, com acesso unificado a dado de robotica em varias modalidades (leitura sensorimotor, varios feed de camera, status de teleoperacao). tambem guarda informacao geral de como o dado foi coletado (metadata), incluindo descricao textual da tarefa, tipo de robo e detalhe de medicao como o frame rate em que a imagem e o estado do robo sao amostrados. a metadata serve pra indexar e buscar dataset de robotica no Hub.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;instalar-lerobot-e-gravar-dataset&quot;&gt;instalar lerobot e gravar dataset&lt;&#x2F;h3&gt;
&lt;p&gt;o v3 vai ser parte do lerobot a partir do &lt;code&gt;lerobot-v0.4.0&lt;&#x2F;code&gt;. da pra instalar a ultima &lt;code&gt;lerobot-v0.3.x&lt;&#x2F;code&gt; que suporta o formato direto do PyPI:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;pip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; install&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;huggingface&#x2F;lerobot&#x2F;archive&#x2F;33cad37054c2b594ceba57463e8f11ee374fa93c.zip&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;gravar dataset com o braco SO-101 por teleoperacao:&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;lerobot-record&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-robot.type=so101_follower&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-robot.port=&#x2F;dev&#x2F;tty.usbmodem585A0076841&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-robot.id=my_awesome_follower_arm&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-robot.cameras=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;{ front: {type: opencv, index_or_path: 0, width: 1920, height: 1080, fps: 30}}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-teleop.type=so101_leader&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-teleop.port=&#x2F;dev&#x2F;tty.usbmodem58760431551&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-teleop.id=my_awesome_leader_arm&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-display_data=true&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-dataset.repo_id=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;$&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;{&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;HF_USER&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;}&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;&#x2F;record-test&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-dataset.num_episodes=5&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; \&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;    -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-dataset.single_task=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;Grab the black cube&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;design-do-formato&quot;&gt;design do formato&lt;&#x2F;h3&gt;
&lt;p&gt;a escolha de design central e separar o storage subjacente da API de usuario. o dataset organiza em tres componentes:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;tabular data: dado de baixa dimensao e alta frequencia (estado de junta, acao) em arquivo Apache Parquet, tipicamente offloaded pra biblioteca &lt;code&gt;datasets&lt;&#x2F;code&gt;, com acesso memory-mapped ou por streaming.&lt;&#x2F;li&gt;
&lt;li&gt;visual data: pra lidar com volume grande de dado de camera, o frame e concatenado e encodado em arquivo MP4. frame do mesmo episodio sempre agrupado no mesmo video, varios video agrupados por camera. pra reduzir o stress no file system, grupo de video da mesma camera tambem e quebrado em subdiretorio.&lt;&#x2F;li&gt;
&lt;li&gt;metadata: colecao de arquivo JSON que descreve a estrutura do dataset, contraparte relacional do tabular e do visual. inclui schema de feature, frame rate, estatistica de normalizacao, fronteira de episodio.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;pra suportar dataset com milhoes de episodio (centenas de milhoes ou bilhoes de frame), o dado de episodio diferente e merged na mesma estrutura. qualquer colecao tabular e qualquer video nao tem so um episodio, e a concatenacao de varios. a metadata recupera a info especifica do episodio (timestamp de inicio e fim de um episodio num video).&lt;&#x2F;p&gt;
&lt;p&gt;estrutura do repositorio:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;meta&#x2F;info.json&lt;&#x2F;code&gt;: arquivo central de metadata, schema completo do dataset, todas as features (&lt;code&gt;observation.state&lt;&#x2F;code&gt;, &lt;code&gt;action&lt;&#x2F;code&gt;), shapes, tipos. tambem guarda fps, versao da codebase, e os path templates pra localizar arquivo de dado e de video.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;meta&#x2F;stats.json&lt;&#x2F;code&gt;: estatistica agregada (mean, std, min, max) por feature em todo o dataset, usada pra normalizacao, acessivel via &lt;code&gt;dataset.meta.stats&lt;&#x2F;code&gt;.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;meta&#x2F;tasks.jsonl&lt;&#x2F;code&gt;: mapeia descricao de tarefa em linguagem natural pra indice inteiro de tarefa, usado em policy training condicionado por tarefa.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;meta&#x2F;episodes&#x2F;&lt;&#x2F;code&gt;: metadata de cada episodio individual (length, tarefa correspondente, ponteiro de onde o dado fica). pra escalar, guardado em Parquet chunked, nao num JSON grande.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;data&#x2F;&lt;&#x2F;code&gt;: dado tabular frame a frame em Parquet, dado de varios episodios concatenado em arquivo maior, organizado em subdiretorio chunked.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;videos&#x2F;&lt;&#x2F;code&gt;: arquivo MP4 de todo stream de observacao visual, video de varios episodios concatenado em MP4 unico, reduzindo o numero de arquivo. a estrutura de path (&lt;code&gt;&#x2F;videos&#x2F;&amp;lt;camera_key&amp;gt;&#x2F;&amp;lt;chunk&amp;gt;&#x2F;file_...mp4&lt;&#x2F;code&gt;) deixa o data loader localizar o arquivo certo e fazer seek pro timestamp do frame.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;migrar-do-v2-1-pro-v3-0&quot;&gt;migrar do v2.1 pro v3.0&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;python&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;m&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; lerobot.datasets.v30.convert_dataset_v21_to_v30&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;-repo-id=&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;HFUSER&#x2F;DATASET_ID&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;&amp;gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;o script &lt;code&gt;convert_dataset_v21_to_v30.py&lt;&#x2F;code&gt; agrega os varios episodios &lt;code&gt;episode-0000.mp4, episode-0001.mp4, ...&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;episode-0000.parquet, ...&lt;&#x2F;code&gt; em arquivo unico &lt;code&gt;file-0000.mp4&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;file-0000.parquet&lt;&#x2F;code&gt;, e atualiza a metadata pra recuperar a info especifica do episodio dos arquivos de nivel mais alto.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;exemplo-com-torch-dataloader&quot;&gt;exemplo com torch DataLoader&lt;&#x2F;h3&gt;
&lt;p&gt;todo dataset no Hub com os tres pilares (tabular, visual, metadata) acessa com uma linha. a maioria dos algoritmo de robot learning (RL ou behavioral cloning) opera num stack de observacao e acao. RL tipicamente usa historico de observacao previa &lt;code&gt;o_{t-H_o:t}&lt;&#x2F;code&gt;, BC tipicamente regressa chunk de varias acao. o LeRobotDataset tem operacao nativa de windowing pelo argumento &lt;code&gt;delta_timestamps&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; lerobot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;datasets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;lerobot_dataset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; LeRobotDataset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;repo_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;yaak-ai&#x2F;L2D-v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dataset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; LeRobotDataset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;repo_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sample&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dataset&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;     &amp;#39;observation.state&amp;#39;: tensor([...]),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;     &amp;#39;action&amp;#39;: tensor([...]),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;     &amp;#39;observation.images.front_left&amp;#39;: tensor([C, H, W]),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;     &amp;#39;timestamp&amp;#39;: tensor(1.234),&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; }&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;delta_timestamps&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; {&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;    &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;observation.images.front_left&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;span&gt; [&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;-&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;0.2&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; -&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;0.1&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 0.0&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;  #&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; 0.2 e 0.1 seg antes da observacao&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dataset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; LeRobotDataset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;repo_id&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; delta_timestamps&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;delta_timestamps&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;sample&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; dataset&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt;100&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; &amp;#39;observation.images.front_left&amp;#39; agora tem shape [T, C, H, W], T=3&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt;print&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;sample&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;observation.images.front_left&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;shape&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;batch_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 16&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;data_loader&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; torch&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;utils&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;data&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;DataLoader&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;dataset&lt;&#x2F;span&gt;&lt;span&gt;,&lt;&#x2F;span&gt;&lt;span&gt; batch_size&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;=&lt;&#x2F;span&gt;&lt;span&gt;batch_size&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;num_epochs&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#D33682, #D33682);&quot;&gt; 1&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;device&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;cuda&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; if&lt;&#x2F;span&gt;&lt;span&gt; torch&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;cuda&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;is_available&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; else&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;cpu&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;for&lt;&#x2F;span&gt;&lt;span&gt; epoch&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#268BD2, #268BD2);&quot;&gt; range&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;num_epochs&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;    for&lt;&#x2F;span&gt;&lt;span&gt; batch&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; in&lt;&#x2F;span&gt;&lt;span&gt; data_loader&lt;&#x2F;span&gt;&lt;span&gt;:&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        observations&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; batch&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;observation.state.vehicle&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;device&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        actions&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; batch&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;action.continuous&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;device&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        images&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; batch&lt;&#x2F;span&gt;&lt;span&gt;[&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;observation.images.front_left&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;span&gt;]&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;to&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;device&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#CB4B16, #CB4B16);&quot;&gt;        ...&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;streaming&quot;&gt;streaming&lt;&#x2F;h3&gt;
&lt;pre class=&quot;giallo&quot; style=&quot;color-scheme: light dark; color: light-dark(#657B83, #839496); background-color: light-dark(#FDF6E3, #002B36);&quot;&gt;&lt;code data-lang=&quot;python&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt;from&lt;&#x2F;span&gt;&lt;span&gt; lerobot&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;datasets&lt;&#x2F;span&gt;&lt;span&gt;.&lt;&#x2F;span&gt;&lt;span&gt;streaming_dataset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; import&lt;&#x2F;span&gt;&lt;span&gt; StreamingLeRobotDataset&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt;#&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#93A1A1, #586E75);font-style: italic;&quot;&gt; Streams direto do Hub, sem baixar nem carregar na memoria&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;repo_id&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt; &amp;quot;&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;yaak-ai&#x2F;L2D-v3&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#2AA198, #2AA198);&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;dataset&lt;&#x2F;span&gt;&lt;span style=&quot;color: light-dark(#859900, #859900);&quot;&gt; =&lt;&#x2F;span&gt;&lt;span&gt; StreamingLeRobotDataset&lt;&#x2F;span&gt;&lt;span&gt;(&lt;&#x2F;span&gt;&lt;span&gt;repo_id&lt;&#x2F;span&gt;&lt;span&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;&lt;h3 id=&quot;conclusao-1&quot;&gt;conclusao&lt;&#x2F;h3&gt;
&lt;p&gt;o v3.0 e um passo pra escalar dataset de robotica no LeRobot. fornecendo um formato pra guardar e acessar colecao grande de dado de robo, permite a comunidade treinar em potencialmente milhoes de episodio sem nem baixar o dado. o time agradece o time da yaak.ai pelo suporte no desenvolvimento.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;contribuicao-do-lerobotdataset&quot;&gt;contribuicao do LeRobotDataset&lt;&#x2F;h3&gt;
&lt;p&gt;reducao media de tamanho: 14% do tamanho original do dataset (ate 0.2% no melhor caso). melhora de loading: frame unico comparavel ao PNG, frame multiplo sucessivo 25% a 50% do tempo de PNG. preservacao de qualidade: capacidade de treino mantida. ferramenta de visualizacao: browsing facil do dataset.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;fundamentos-de-video-encoding&quot;&gt;fundamentos de video encoding&lt;&#x2F;h3&gt;
&lt;p&gt;duas tecnicas principais: compressao espacial (mesmo principio do JPEG&#x2F;PNG, explora auto-similaridade dentro do frame) e compressao temporal (guarda a diferenca entre frame em vez do frame inteiro, exige keyframe I-frame em intervalo regular como ponto de referencia).&lt;&#x2F;p&gt;
&lt;p&gt;processo de encoding: 1. determina keyframe pela especificacao do usuario e pela mudanca de cena, 2. comprime keyframe espacialmente, 3. comprime a diferenca inter-frame (P-frame, B-frame) temporalmente, 4. aplica compressao espacial nessa diferenca, 5. encoda o dado comprimido em bitstream, 6. empacota o bitstream em container (MP4, MKV, AVI), 7. aplica processamento extra pra reduzir distorcao visual.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;criterios-de-avaliacao&quot;&gt;criterios de avaliacao&lt;&#x2F;h3&gt;
&lt;p&gt;quatro criterios: tamanho (impacta storage e download), tempo de decodificacao (impacta tempo de treino), qualidade (impacta acuracia de treino), compatibilidade (capacidade de decodar e visualizar em varios device&#x2F;plataforma).&lt;&#x2F;p&gt;
&lt;p&gt;metrica de tamanho: razao de compressao = tamanho do video encodado dividido pelo tamanho dos frames originais nao comprimidos. tempo de loading: tempo de decodar frame dividido pelo tempo de carregar de imagem individual. metrica de qualidade: MSE (mean square error, menor melhor), PSNR (peak signal-to-noise ratio, maior melhor), SSIM (structural similarity index measure, varia de -1 a 1, maior melhor).&lt;&#x2F;p&gt;
&lt;h3 id=&quot;variaveis-testadas&quot;&gt;variaveis testadas&lt;&#x2F;h3&gt;
&lt;p&gt;datasets (4 exemplos representativos): &lt;code&gt;lerobot&#x2F;pusht_image&lt;&#x2F;code&gt; 96x96 px simulacao formas simples, &lt;code&gt;aliberts&#x2F;aloha_mobile_shrimp_image&lt;&#x2F;code&gt; 480x640 px real indoor camera movel, &lt;code&gt;aliberts&#x2F;paris_street&lt;&#x2F;code&gt; 720x1280 px real outdoor camera movel, &lt;code&gt;aliberts&#x2F;kitchen&lt;&#x2F;code&gt; 1080x1920 px real indoor camera fixa.&lt;&#x2F;p&gt;
&lt;p&gt;parametros de encoding:&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;parametro&lt;&#x2F;th&gt;&lt;th&gt;valores&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;vcodec&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;libx264&lt;&#x2F;code&gt;, &lt;code&gt;libx265&lt;&#x2F;code&gt;, &lt;code&gt;libsvtav1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;pix_fmt&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;yuv444p&lt;&#x2F;code&gt;, &lt;code&gt;yuv420p&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;g (GOP size)&lt;&#x2F;td&gt;&lt;td&gt;1, 2, 3, 4, 5, 6, 10, 15, 20, 40, None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;crf&lt;&#x2F;td&gt;&lt;td&gt;0, 5, 10, 15, 20, 25, 30, 40, 50, None&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;vcodec e o motor algoritmico do encoding. pix_fmt especifica o color space (YUV, RGB, grayscale); pra YUV, o chroma subsampling (&lt;code&gt;yuv420p&lt;&#x2F;code&gt; = 4:2:0, mais compativel com web; &lt;code&gt;yuv444p&lt;&#x2F;code&gt; info de cor completa mas menos compativel com browser). g determina a frequencia de keyframe (valor menor = mais keyframe = acesso aleatorio a frame mais rapido; valor maior = acesso mais lento mas arquivo menor; pra treino de ML precisa de valor menor; midia tradicional aceita 2-4 segundos entre keyframe). crf controla a quantidade de compressao com perda (0 = sem perda, 50-60 = muito lossy; preferivel a targeting de bitrate porque mantem qualidade visual constante com bitrate variavel).&lt;&#x2F;p&gt;
&lt;p&gt;decoder testado: &lt;code&gt;pyav&lt;&#x2F;code&gt; (default), &lt;code&gt;video_reader&lt;&#x2F;code&gt;. cenario de timestamp: &lt;code&gt;1_frame&lt;&#x2F;code&gt;, &lt;code&gt;2_frames&lt;&#x2F;code&gt;, &lt;code&gt;6_frames&lt;&#x2F;code&gt;, &lt;code&gt;2_frames_4_space&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;resultados&quot;&gt;resultados&lt;&#x2F;h3&gt;
&lt;h4 id=&quot;mudanca-de-versao&quot;&gt;mudanca de versao&lt;&#x2F;h4&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;metrica&lt;&#x2F;th&gt;&lt;th&gt;v1.5&lt;&#x2F;th&gt;&lt;th&gt;v1.6&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;vcodec&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;libx264&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;libsvtav1&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;pix-fmt&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;yuv444p&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;td&gt;&lt;code&gt;yuv420p&lt;&#x2F;code&gt;&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;g&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;td&gt;2&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;crf&lt;&#x2F;td&gt;&lt;td&gt;None (=23)&lt;&#x2F;td&gt;&lt;td&gt;30&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;melhora: melhor qualidade com encoding AV1 e melhor compatibilidade com &lt;code&gt;yuv420p&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tamanho&quot;&gt;tamanho&lt;&#x2F;h4&gt;
&lt;p&gt;razao de compressao media ~14% em todos os datasets. maioria &amp;lt;40% do tamanho original. melhor caso &amp;lt;1% do tamanho original. variacao por formato original (imagem nao comprimida comprime melhor), imagem ja comprimida (JPEG&#x2F;PNG comprime menos), resolucao, complexidade de cena. exemplo de reducao: &lt;code&gt;lerobot&#x2F;nyu_rot_dataset&lt;&#x2F;code&gt; 5.3MB -&amp;gt; 318.2KB (5.8%), &lt;code&gt;lerobot&#x2F;aloha_sim_transfer_cube_human&lt;&#x2F;code&gt; 17.9GB -&amp;gt; 66.7MB (0.4%), &lt;code&gt;lerobot&#x2F;berkeley_gnm_recon&lt;&#x2F;code&gt; 18.7GB -&amp;gt; 29.3MB (0.2%).&lt;&#x2F;p&gt;
&lt;h4 id=&quot;tempo-de-loading&quot;&gt;tempo de loading&lt;&#x2F;h4&gt;
&lt;p&gt;video loading escala melhor com resolucao, principalmente pra multiplos frame. pra small (96x96) e large (1080x1920): frame unico comparavel ao PNG, 2 e 6 consecutivos 25-50% do tempo de PNG.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;qualidade-g-2-crf-30&quot;&gt;qualidade (g=2, crf=30)&lt;&#x2F;h4&gt;
&lt;p&gt;pra &lt;code&gt;lerobot&#x2F;kitchen&lt;&#x2F;code&gt; (1080x1920, 2.07 megapixels):&lt;&#x2F;p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;codec&lt;&#x2F;th&gt;&lt;th&gt;format&lt;&#x2F;th&gt;&lt;th&gt;MSE&lt;&#x2F;th&gt;&lt;th&gt;PSNR&lt;&#x2F;th&gt;&lt;th&gt;SSIM&lt;&#x2F;th&gt;&lt;&#x2F;tr&gt;&lt;&#x2F;thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;libx264&lt;&#x2F;td&gt;&lt;td&gt;yuv420p&lt;&#x2F;td&gt;&lt;td&gt;2.32E-04&lt;&#x2F;td&gt;&lt;td&gt;36.77&lt;&#x2F;td&gt;&lt;td&gt;95.47%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;libx264&lt;&#x2F;td&gt;&lt;td&gt;yuv444p&lt;&#x2F;td&gt;&lt;td&gt;2.06E-04&lt;&#x2F;td&gt;&lt;td&gt;37.38&lt;&#x2F;td&gt;&lt;td&gt;95.58%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;libx265&lt;&#x2F;td&gt;&lt;td&gt;yuv420p&lt;&#x2F;td&gt;&lt;td&gt;6.87E-04&lt;&#x2F;td&gt;&lt;td&gt;35.27&lt;&#x2F;td&gt;&lt;td&gt;95.11%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;libx265&lt;&#x2F;td&gt;&lt;td&gt;yuv444p&lt;&#x2F;td&gt;&lt;td&gt;6.75E-04&lt;&#x2F;td&gt;&lt;td&gt;35.50&lt;&#x2F;td&gt;&lt;td&gt;95.13%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;tr&gt;&lt;td&gt;libsvtav1&lt;&#x2F;td&gt;&lt;td&gt;yuv420p&lt;&#x2F;td&gt;&lt;td&gt;1.32E-04&lt;&#x2F;td&gt;&lt;td&gt;39.20&lt;&#x2F;td&gt;&lt;td&gt;96.84%&lt;&#x2F;td&gt;&lt;&#x2F;tr&gt;
&lt;&#x2F;tbody&gt;&lt;&#x2F;table&gt;
&lt;p&gt;libsvtav1 com yuv420p entrega a melhor metrica de qualidade.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;validacao-de-treino-de-policy&quot;&gt;validacao de treino de policy&lt;&#x2F;h4&gt;
&lt;p&gt;policy treinada em dataset encodado teve performance equivalente a treinada na versao de imagem. diffusion policy no PushT: curva de treino identica entre formato, sem degradacao. ACT policy no ALOHA: curva identica, sem degradacao. AV1 vs H264: diffusion no pusht AV1 aprox H264, ACT no aloha_sim_transfer_cube_human AV1 aprox H264, ACT no aloha_sim_insertion_scripted AV1 aprox H264.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;future-work&quot;&gt;future work&lt;&#x2F;h3&gt;
&lt;p&gt;parametro de encoding a explorar: &lt;code&gt;-preset&lt;&#x2F;code&gt; (trade-off velocidade&#x2F;compressao), &lt;code&gt;-tune&lt;&#x2F;code&gt; (otimizar pra aspecto especifico, film quality, live, fast decode), two-pass encoding (aumenta qualidade ao custo de tempo de encoding). decoder alternativo: &lt;code&gt;torchcodec&lt;&#x2F;code&gt;, &lt;code&gt;torchaudio&lt;&#x2F;code&gt;, &lt;code&gt;ffmpegio&lt;&#x2F;code&gt;, &lt;code&gt;decord&lt;&#x2F;code&gt;, &lt;code&gt;nvc&lt;&#x2F;code&gt;. outras consideracoes: video encoding com depth map, otimizacao de parametro de codec, exploracao de outro container.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;conclusao-2&quot;&gt;conclusao&lt;&#x2F;h3&gt;
&lt;p&gt;o benchmark demonstra que o codec AV1 com pixel format yuv420p e CRF conservador da o melhor balanco de tamanho, qualidade, velocidade e compatibilidade pra dataset de robotica. o video encoding resolve a escalabilidade de dataset de robotica reduzindo storage pra ~14% do original em media, mantendo ou melhorando a velocidade de loading pra multiplos frame, preservando a qualidade de treino e a performance da policy.&lt;&#x2F;p&gt;
&lt;p&gt;future&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
