Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

image processing for GC

from time import time
import numpy as np
import tensorflow as tf
import tensorflow_datasets as tfds
from tensorflow.keras import layers
from tensorflow.keras.optimizers import RMSprop
from keras.preprocessing.image import ImageDataGenerator
from skimage import io
import os
import glob

# path to your dataset

data_dir = '/content/drive/MyDrive/Manifold_cnn_v2/'
oring_cls = ["Complete","Missing"]

batch_size = 32
img_height = 400
img_width = 400

AUTOTUNE = tf.data.AUTOTUNE

train_ds = tf.keras.utils.image_dataset_from_directory(
  data_dir+"training",
  seed=123,
  image_size=(img_height, img_width),
  batch_size=batch_size)

val_ds = tf.keras.utils.image_dataset_from_directory(
  data_dir+"test",
  seed=123,
  image_size=(img_height, img_width),
  batch_size=batch_size)

class_names = train_ds.class_names
print(class_names)

#plot the first 10 images with their labels
import matplotlib.pyplot as plt

plt.figure(figsize=(10, 10))
for images, labels in train_ds.take(1):
  for i in range(9):
    ax = plt.subplot(3, 3, i + 1)
    plt.imshow(images[i].numpy().astype("uint8"))
    plt.title(class_names[labels[i]])
    plt.axis("off")
Comment

PREVIOUS NEXT
Code Example
Python :: integer to binary python 16 bit 
Python :: python remove title from name 
Python :: Use of Pass 
Python :: pandas split coordinate tuple 
Python :: python inverse dict with repeating values 
Python :: const in python 3 
Python :: Summarize text using LED huggingface 
Python :: django get without exception 
Python :: How to get the positions where values of two columns match? 
Python :: form a chakravyuh matrix python 
Python :: controlliing a fill pattern in matplotlib 
Python :: int var def __init__(self,var=10): Initialize.var=var def display(): print var 
Python :: how to create a leaderboard on python 3.8.1 
Python :: python rename columns 
Python :: hello world in dip 
Python :: spooling in os 
Python :: response object has no code 
Python :: pandas isolate data lower than a certain percentage 
Python :: dfs and bfs inn python 
Python :: fibonacci series recursive python 
Python :: python mypy cast 
Python :: Get Dates Between Two Ranges 
Python :: test if instance in queryset django 
Python :: df.loc jupyter 
Python :: mechanize python LE #3 
Python :: the webpage at http://127.0.0.1:8000/ might be temporarily down or it may have moved permanently to a new web address. django 
Python :: Custom Choropleth Labels in Geopandas 
Python :: python concat list multiple times 
Python :: for i in range(1, 11): print(i, end="") 
Python :: change xlabel size 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =