SlideShare a Scribd company logo
1 of 22
Download to read offline
Classificando Imagens
com Redes Neurais
Convolucionais
Sandro Moreira

@sandro_moreira

Oficina Prática
Relembrando
Rede Neural Convolucional
• Problema: Entrada pode ter uma dimensão muito alta.
Utilizando uma MLP (Multi Layer Perceptron), precisamos
de uma quantidade muito grande de parâmetros

• Inspirado nos experimentos de neurofisiologia de Hubel &
Weisel (1962), CNN (Convolutional Neural Network) são um
tipo especial de redes neurais que usam o conceito de
campo receptivo local
Exemplo: Imagem
200x200px

MLP - 40.000 hidden units =
1,6 bilhões de parâmetros

CNN - 5x5 kernel, 100
campos receptivos = 2500
parâmetros
Rede Neural Convolucional
• Yann LeCun - Professor of Computer
Science The Courant Institute of
Mathematical Sciences

• Atualmente, diretor de IA do Facebook

• Em 1995, Yann LeCun e Yoshua Bengio
introduziram o conceito de redes neurais
convolucionais
CNN’s
• CNN’s foram inspiradas pela sensibilidade local e
orientação seletiva do cérebro

• Projetaram uma rede neural que implicitamente extraíam
as características relevantes de entrada

• É uma rede feed-forward que extrai propriedades
topológicas a partir da imagem

• Capaz de reconhecer padrões com muita variabilidade
(Ex. Caracteres escritos à mão)
Funcionamento de uma CNN
Decidir se a imagem contém um X ou O
Funcionamento de uma CNN
Funcionamento de uma CNN
Complexidades
Rede Neural Convolucional
É IGUAL A ?
Rede Neural Convolucional
É IGUAL A ?
Convoluções
Como funciona?
Extração de Características
Extração de Características
Arquitetura Inception V3
Implementando
• Python - Linguagem de Programação

• Google TensorFlow - Biblioteca para ML e Deep
Learning

• Keras - Biblioteca Alto Nível para TensorFlow

• Colaboratory - Ambiente on line para implementações
de scripts ML

• Google Drive - Disco virtual
Passo 1 - Ambiente
• Criar uma pasta “DeepLearning" dentro de seu Google
Drive

• Dentro da pasta DeepLearning", criar um documento do
Colaboratory (notebook)

• Configurar para utilizar a linguagem Python3 e GPU
(Edit >> notebook settings >> python3 e GPU)
• Baixe o repositório: 

https://github.com/smoreira/OficinaRedesConvolucionais
Passo 2 - Ambiente
#criar um notebook a partir do google drive.

#configurar edit >> notebook settings >> python3 e GPU

#comandos para autenticacao do Google Drive e Google Cloud
Platform com o Colaboratory

!apt-get install -y -qq software-properties-common
python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa
2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse
fuse
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds =
GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -
id={creds.client_id} -secret={creds.client_secret}
< /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -
id={creds.client_id} -secret={creds.client_secret}
#montar o drive para acesso pelo python

!mkdir -p drive
!google-drive-ocamlfuse drive
#instalando o keras

!pip install -q keras
#exemplo de execucao de scripts que criamos em python

!python3 drive/DeepLearning/meus_scripts.py
Arquivo:
config_drive_colab.txt
no repositório
Executando
• Rede Neural Convolucional Inception - modelo criado pela Google

• Treinamento:
!python3 drive/DeepLearning/oficinaConvNet/image_retraining/retrain.py 
--bottleneck_dir=bottlenecks 
--how_many_training_steps 500 
--model_dir=inception 
--output_graph=retrained_graph.pb 
--output_labels=retrained_labels.txt 
--image_dir=drive/DeepLearning/oficinaConvNet/data
• Executando:
!python3 drive/DeepLearning/oficinaConvNet/label_image.py drive/
DeepLearning/oficinaConvNet/homer.jpg
Considerações finais
• Modelo pode ser retreinado para reconhecer qualquer
grupo de imagens

• Existem outros modelos prontos para serem utilizados
via TensorFlow

• Vários modelos de Redes Convolucionais podem ser
replicados, você também pode criar seu próprio modelo
Referências
Soares, Anderson; Redes Neurais Profundas –DeepLearning - Aula
4 - Convolutional Neural Network; Instituto de Informática;
Universidade Federal de Goiás; 2017
https://medium.com/@curioushruti/how-to-guide-cnns-using-
tensorflow-keras-tensorflow-serving-in-google-
colaboratory-878e5884d03
Moreira, Sandro; Oficina de TensorFlow e Keras; Deep Learning
Brasil Summer School; 2018
Sandro Moreira
@sandro_moreira

moreira.sandro@gmail.com

www.youtube.com/sandromoreirago
Obrigado!

More Related Content

What's hot

Intro to Deep Learning for Computer Vision
Intro to Deep Learning for Computer VisionIntro to Deep Learning for Computer Vision
Intro to Deep Learning for Computer VisionChristoph Körner
 
Deep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksDeep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksChristian Perone
 
Tutorial on Object Detection (Faster R-CNN)
Tutorial on Object Detection (Faster R-CNN)Tutorial on Object Detection (Faster R-CNN)
Tutorial on Object Detection (Faster R-CNN)Hwa Pyung Kim
 
ResNet basics (Deep Residual Network for Image Recognition)
ResNet basics (Deep Residual Network for Image Recognition)ResNet basics (Deep Residual Network for Image Recognition)
ResNet basics (Deep Residual Network for Image Recognition)Sanjay Saha
 
Neural collaborative filtering-발표
Neural collaborative filtering-발표Neural collaborative filtering-발표
Neural collaborative filtering-발표hyunsung lee
 
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...Simplilearn
 
CVPR 2018 Paper Reading MobileNet V2
CVPR 2018 Paper Reading MobileNet V2CVPR 2018 Paper Reading MobileNet V2
CVPR 2018 Paper Reading MobileNet V2Khang Pham
 
PR-217: EfficientDet: Scalable and Efficient Object Detection
PR-217: EfficientDet: Scalable and Efficient Object DetectionPR-217: EfficientDet: Scalable and Efficient Object Detection
PR-217: EfficientDet: Scalable and Efficient Object DetectionJinwon Lee
 
Classifying Text using CNN
Classifying Text using CNNClassifying Text using CNN
Classifying Text using CNNSomnath Banerjee
 
backpropagation in neural networks
backpropagation in neural networksbackpropagation in neural networks
backpropagation in neural networksAkash Goel
 
Kernels and Support Vector Machines
Kernels and Support Vector  MachinesKernels and Support Vector  Machines
Kernels and Support Vector MachinesEdgar Marca
 
Convolutional Neural Network
Convolutional Neural NetworkConvolutional Neural Network
Convolutional Neural NetworkVignesh Suresh
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural networkFerdous ahmed
 
Convolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep LearningConvolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep LearningMohamed Loey
 
KERAS Python Tutorial
KERAS Python TutorialKERAS Python Tutorial
KERAS Python TutorialMahmutKAMALAK
 
Horovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlow
Horovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlowHorovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlow
Horovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlowDatabricks
 
Convolutional neural network
Convolutional neural network Convolutional neural network
Convolutional neural network Yan Xu
 

What's hot (20)

Intro to Deep Learning for Computer Vision
Intro to Deep Learning for Computer VisionIntro to Deep Learning for Computer Vision
Intro to Deep Learning for Computer Vision
 
Deep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksDeep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural Networks
 
Tutorial on Object Detection (Faster R-CNN)
Tutorial on Object Detection (Faster R-CNN)Tutorial on Object Detection (Faster R-CNN)
Tutorial on Object Detection (Faster R-CNN)
 
ResNet basics (Deep Residual Network for Image Recognition)
ResNet basics (Deep Residual Network for Image Recognition)ResNet basics (Deep Residual Network for Image Recognition)
ResNet basics (Deep Residual Network for Image Recognition)
 
Neural collaborative filtering-발표
Neural collaborative filtering-발표Neural collaborative filtering-발표
Neural collaborative filtering-발표
 
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...
Convolutional Neural Network - CNN | How CNN Works | Deep Learning Course | S...
 
Cnn 강의
Cnn 강의Cnn 강의
Cnn 강의
 
CVPR 2018 Paper Reading MobileNet V2
CVPR 2018 Paper Reading MobileNet V2CVPR 2018 Paper Reading MobileNet V2
CVPR 2018 Paper Reading MobileNet V2
 
PR-217: EfficientDet: Scalable and Efficient Object Detection
PR-217: EfficientDet: Scalable and Efficient Object DetectionPR-217: EfficientDet: Scalable and Efficient Object Detection
PR-217: EfficientDet: Scalable and Efficient Object Detection
 
Classifying Text using CNN
Classifying Text using CNNClassifying Text using CNN
Classifying Text using CNN
 
backpropagation in neural networks
backpropagation in neural networksbackpropagation in neural networks
backpropagation in neural networks
 
AlexNet
AlexNetAlexNet
AlexNet
 
Kernels and Support Vector Machines
Kernels and Support Vector  MachinesKernels and Support Vector  Machines
Kernels and Support Vector Machines
 
CNN Algorithm
CNN AlgorithmCNN Algorithm
CNN Algorithm
 
Convolutional Neural Network
Convolutional Neural NetworkConvolutional Neural Network
Convolutional Neural Network
 
Convolutional neural network
Convolutional neural networkConvolutional neural network
Convolutional neural network
 
Convolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep LearningConvolutional Neural Network Models - Deep Learning
Convolutional Neural Network Models - Deep Learning
 
KERAS Python Tutorial
KERAS Python TutorialKERAS Python Tutorial
KERAS Python Tutorial
 
Horovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlow
Horovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlowHorovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlow
Horovod: Uber’s Open Source Distributed Deep Learning Framework for TensorFlow
 
Convolutional neural network
Convolutional neural network Convolutional neural network
Convolutional neural network
 

Similar to Classificando Imagens com Redes Neurais Convolucionais

Beers & Bytes - O Futuro da virtualização
Beers & Bytes - O Futuro da virtualizaçãoBeers & Bytes - O Futuro da virtualização
Beers & Bytes - O Futuro da virtualizaçãoCarlos Smaniotto
 
Administracao de sistemas_com_puppet
Administracao de sistemas_com_puppetAdministracao de sistemas_com_puppet
Administracao de sistemas_com_puppetRamon Mota
 
Apresentação Openstack - FISL 2013
Apresentação Openstack - FISL 2013Apresentação Openstack - FISL 2013
Apresentação Openstack - FISL 2013Marcelo Dieder
 
Workshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e KubernetesWorkshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e KubernetesRodrigo Cândido da Silva
 
Padrōes, Especificações, Runtimes: construindo containers melhores
Padrōes, Especificações, Runtimes: construindo containers melhoresPadrōes, Especificações, Runtimes: construindo containers melhores
Padrōes, Especificações, Runtimes: construindo containers melhoresCarlos Andre Fernandes
 
Container revolucao
Container revolucaoContainer revolucao
Container revolucaoFernando Ike
 
Apresentação GT - Digital Preservation
Apresentação GT - Digital PreservationApresentação GT - Digital Preservation
Apresentação GT - Digital PreservationRoberto Beraldo Chaiben
 
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...Renato Groff
 
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...Renato Groff
 
ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018
ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018
ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018Renato Groff
 
Datacenter na nuvem
Datacenter na nuvemDatacenter na nuvem
Datacenter na nuvemIgnacio Nin
 
Treinamento de Performance and tuning
Treinamento de Performance and tuningTreinamento de Performance and tuning
Treinamento de Performance and tuningDell Technologies
 
Docker - Tutorial for beginners
Docker - Tutorial for beginnersDocker - Tutorial for beginners
Docker - Tutorial for beginnersRafael Chiavegatto
 
Docker + Kubernetes (devOps)
Docker + Kubernetes (devOps)Docker + Kubernetes (devOps)
Docker + Kubernetes (devOps)Andre Straube
 
Prova de sor 27062011
Prova de sor 27062011Prova de sor 27062011
Prova de sor 27062011Carlos Melo
 

Similar to Classificando Imagens com Redes Neurais Convolucionais (20)

Beers & Bytes - O Futuro da virtualização
Beers & Bytes - O Futuro da virtualizaçãoBeers & Bytes - O Futuro da virtualização
Beers & Bytes - O Futuro da virtualização
 
Administracao de sistemas_com_puppet
Administracao de sistemas_com_puppetAdministracao de sistemas_com_puppet
Administracao de sistemas_com_puppet
 
Globus Toolkit
Globus ToolkitGlobus Toolkit
Globus Toolkit
 
Dismistificando deep learning
Dismistificando deep learningDismistificando deep learning
Dismistificando deep learning
 
Apresentação Openstack - FISL 2013
Apresentação Openstack - FISL 2013Apresentação Openstack - FISL 2013
Apresentação Openstack - FISL 2013
 
Workshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e KubernetesWorkshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
Workshop Microservices - Distribuindo os Microservices com Docker e Kubernetes
 
Padrōes, Especificações, Runtimes: construindo containers melhores
Padrōes, Especificações, Runtimes: construindo containers melhoresPadrōes, Especificações, Runtimes: construindo containers melhores
Padrōes, Especificações, Runtimes: construindo containers melhores
 
Container revolucao
Container revolucaoContainer revolucao
Container revolucao
 
Apresentação GT - Digital Preservation
Apresentação GT - Digital PreservationApresentação GT - Digital Preservation
Apresentação GT - Digital Preservation
 
Dismistificando deep learning
Dismistificando deep learningDismistificando deep learning
Dismistificando deep learning
 
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - Develop...
 
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...
ASP.NET Core + Kubernetes + Azure: Orquestrando containers na nuvem - .NET SP...
 
ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018
ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018
ASP.NET Core + Kubernetes + Azure - Community Bootcamp - Abril/2018
 
Java Seminar
Java SeminarJava Seminar
Java Seminar
 
Datacenter na nuvem
Datacenter na nuvemDatacenter na nuvem
Datacenter na nuvem
 
Treinamento de Performance and tuning
Treinamento de Performance and tuningTreinamento de Performance and tuning
Treinamento de Performance and tuning
 
Docker - Tutorial for beginners
Docker - Tutorial for beginnersDocker - Tutorial for beginners
Docker - Tutorial for beginners
 
Docker + Kubernetes (devOps)
Docker + Kubernetes (devOps)Docker + Kubernetes (devOps)
Docker + Kubernetes (devOps)
 
Prova de sor 27062011
Prova de sor 27062011Prova de sor 27062011
Prova de sor 27062011
 
Meetup Openstack 20190226 - Fabricio Candido
Meetup Openstack 20190226 - Fabricio CandidoMeetup Openstack 20190226 - Fabricio Candido
Meetup Openstack 20190226 - Fabricio Candido
 

More from Sandro Moreira

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Introdução a Machine Learning
Introdução a Machine LearningIntrodução a Machine Learning
Introdução a Machine LearningSandro Moreira
 
Como o Google está Democratizando a Inteligência Artificial?
Como o Google está Democratizando a Inteligência Artificial?Como o Google está Democratizando a Inteligência Artificial?
Como o Google está Democratizando a Inteligência Artificial?Sandro Moreira
 
Deep Learning do Zero ao Impossível: Qual o caminho?
Deep Learning do Zero ao Impossível: Qual o caminho?Deep Learning do Zero ao Impossível: Qual o caminho?
Deep Learning do Zero ao Impossível: Qual o caminho?Sandro Moreira
 
Deep Learning e o Futuro da Inteligência Artificial
Deep Learning e o Futuro da Inteligência ArtificialDeep Learning e o Futuro da Inteligência Artificial
Deep Learning e o Futuro da Inteligência ArtificialSandro Moreira
 
Hands On TensorFlow and Keras
Hands On TensorFlow and KerasHands On TensorFlow and Keras
Hands On TensorFlow and KerasSandro Moreira
 
Vendo nas Nuvens: Uma introdução à API de Visão Computacional da Google
Vendo nas Nuvens: Uma introdução à API de Visão Computacional da GoogleVendo nas Nuvens: Uma introdução à API de Visão Computacional da Google
Vendo nas Nuvens: Uma introdução à API de Visão Computacional da GoogleSandro Moreira
 

More from Sandro Moreira (9)

[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Comecando tensorflow
Comecando tensorflowComecando tensorflow
Comecando tensorflow
 
Introdução a Machine Learning
Introdução a Machine LearningIntrodução a Machine Learning
Introdução a Machine Learning
 
Como o Google está Democratizando a Inteligência Artificial?
Como o Google está Democratizando a Inteligência Artificial?Como o Google está Democratizando a Inteligência Artificial?
Como o Google está Democratizando a Inteligência Artificial?
 
Deep Learning do Zero ao Impossível: Qual o caminho?
Deep Learning do Zero ao Impossível: Qual o caminho?Deep Learning do Zero ao Impossível: Qual o caminho?
Deep Learning do Zero ao Impossível: Qual o caminho?
 
Deep Learning e o Futuro da Inteligência Artificial
Deep Learning e o Futuro da Inteligência ArtificialDeep Learning e o Futuro da Inteligência Artificial
Deep Learning e o Futuro da Inteligência Artificial
 
Hands On TensorFlow and Keras
Hands On TensorFlow and KerasHands On TensorFlow and Keras
Hands On TensorFlow and Keras
 
Devfest cerrado2017
Devfest cerrado2017Devfest cerrado2017
Devfest cerrado2017
 
Vendo nas Nuvens: Uma introdução à API de Visão Computacional da Google
Vendo nas Nuvens: Uma introdução à API de Visão Computacional da GoogleVendo nas Nuvens: Uma introdução à API de Visão Computacional da Google
Vendo nas Nuvens: Uma introdução à API de Visão Computacional da Google
 

Classificando Imagens com Redes Neurais Convolucionais

  • 1. Classificando Imagens com Redes Neurais Convolucionais Sandro Moreira @sandro_moreira Oficina Prática
  • 3. Rede Neural Convolucional • Problema: Entrada pode ter uma dimensão muito alta. Utilizando uma MLP (Multi Layer Perceptron), precisamos de uma quantidade muito grande de parâmetros • Inspirado nos experimentos de neurofisiologia de Hubel & Weisel (1962), CNN (Convolutional Neural Network) são um tipo especial de redes neurais que usam o conceito de campo receptivo local Exemplo: Imagem 200x200px MLP - 40.000 hidden units = 1,6 bilhões de parâmetros CNN - 5x5 kernel, 100 campos receptivos = 2500 parâmetros
  • 4. Rede Neural Convolucional • Yann LeCun - Professor of Computer Science The Courant Institute of Mathematical Sciences • Atualmente, diretor de IA do Facebook • Em 1995, Yann LeCun e Yoshua Bengio introduziram o conceito de redes neurais convolucionais
  • 5. CNN’s • CNN’s foram inspiradas pela sensibilidade local e orientação seletiva do cérebro • Projetaram uma rede neural que implicitamente extraíam as características relevantes de entrada • É uma rede feed-forward que extrai propriedades topológicas a partir da imagem • Capaz de reconhecer padrões com muita variabilidade (Ex. Caracteres escritos à mão)
  • 6. Funcionamento de uma CNN Decidir se a imagem contém um X ou O
  • 8. Funcionamento de uma CNN Complexidades
  • 16. Implementando • Python - Linguagem de Programação • Google TensorFlow - Biblioteca para ML e Deep Learning • Keras - Biblioteca Alto Nível para TensorFlow • Colaboratory - Ambiente on line para implementações de scripts ML • Google Drive - Disco virtual
  • 17. Passo 1 - Ambiente • Criar uma pasta “DeepLearning" dentro de seu Google Drive • Dentro da pasta DeepLearning", criar um documento do Colaboratory (notebook) • Configurar para utilizar a linguagem Python3 e GPU (Edit >> notebook settings >> python3 e GPU) • Baixe o repositório: 
 https://github.com/smoreira/OficinaRedesConvolucionais
  • 18. Passo 2 - Ambiente #criar um notebook a partir do google drive. #configurar edit >> notebook settings >> python3 e GPU #comandos para autenticacao do Google Drive e Google Cloud Platform com o Colaboratory !apt-get install -y -qq software-properties-common python-software-properties module-init-tools !add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null !apt-get update -qq 2>&1 > /dev/null !apt-get -y install -qq google-drive-ocamlfuse fuse from google.colab import auth auth.authenticate_user() from oauth2client.client import GoogleCredentials creds = GoogleCredentials.get_application_default() import getpass !google-drive-ocamlfuse -headless - id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL vcode = getpass.getpass() !echo {vcode} | google-drive-ocamlfuse -headless - id={creds.client_id} -secret={creds.client_secret} #montar o drive para acesso pelo python !mkdir -p drive !google-drive-ocamlfuse drive #instalando o keras !pip install -q keras #exemplo de execucao de scripts que criamos em python !python3 drive/DeepLearning/meus_scripts.py Arquivo: config_drive_colab.txt no repositório
  • 19. Executando • Rede Neural Convolucional Inception - modelo criado pela Google • Treinamento: !python3 drive/DeepLearning/oficinaConvNet/image_retraining/retrain.py --bottleneck_dir=bottlenecks --how_many_training_steps 500 --model_dir=inception --output_graph=retrained_graph.pb --output_labels=retrained_labels.txt --image_dir=drive/DeepLearning/oficinaConvNet/data • Executando: !python3 drive/DeepLearning/oficinaConvNet/label_image.py drive/ DeepLearning/oficinaConvNet/homer.jpg
  • 20. Considerações finais • Modelo pode ser retreinado para reconhecer qualquer grupo de imagens • Existem outros modelos prontos para serem utilizados via TensorFlow • Vários modelos de Redes Convolucionais podem ser replicados, você também pode criar seu próprio modelo
  • 21. Referências Soares, Anderson; Redes Neurais Profundas –DeepLearning - Aula 4 - Convolutional Neural Network; Instituto de Informática; Universidade Federal de Goiás; 2017 https://medium.com/@curioushruti/how-to-guide-cnns-using- tensorflow-keras-tensorflow-serving-in-google- colaboratory-878e5884d03 Moreira, Sandro; Oficina de TensorFlow e Keras; Deep Learning Brasil Summer School; 2018