Snippets Collections
if(input.Start_Date_Time != null && input.Service_Lookup != null)
{
	getServiceDetails = Add_Services[ID == input.Service_Lookup];
	serviceMinutes = getServiceDetails.Service_Time;
	input.End_Date_Time = input.Start_Date_Time.addMinutes(serviceMinutes);
}
def create_dir(path, sub_dirs, label_dirs):
    for sub_dir in sub_dirs: 
        for label_dir in label_dirs:
            new_dir = os.path.join(path, sub_dir, label_dir)
            Path(new_dir).mkdir(parents=True, exist_ok=True)
            print(new_dir)
    
    print('All directories created successfully!')

FOLDER_PATH = 'dataset/'
SUB_DIRS = ['train/', 'test/']
LABEL_DIR = ['dogs/', 'cats/']

create_dir(FOLDER_PATH, SUB_DIRS, LABEL_DIR)
train_datagen = image.ImageDataGenerator(
  	rescale = 1./255,  # to normalize bigger values. Convert from 0-255 to 0-1 range.
    shear_range = 0.2,
    zoom_range = 0.2,
    horizontal_flip = True
)


# only rescaling done on test dataset
test_datagen = image.ImageDataGenerator(
    rescale = 1./255
)

train_generator = train_datagen.flow_from_directory(
    directory=TRAIN_PATH,
    target_size=(224,224),
    batch_size=32,
    class_mode='binary',
    save_to_dir = SAVE_TRAIN_PATH,
    save_prefix='',
    save_format='png'
)

validation_generator = test_datagen.flow_from_directory(
    VAL_PATH,
    target_size = (224,224),
    batch_size = 32,
    class_mode = 'binary'
)

# 
train_generator.class_indices
validation_generator.class_indices

# generate augmented images and save into the directory
for i in range(5):
  train_generator.next()
  
  
import pathlib
from pathlib import Path

def create_folder(path):
  if Path(path).is_dir():
    print ("Folder already exists!")
  else:
    pathlib.Path(path).mkdir(parents=True, exist_ok=True) 
    print ("Folder created!")    


FOLDER_PATH = '/content/drive/MyDrive/detect-covid19-xray/data-preprocessed'
create_folder(FOLDER_PATH)

star

Fri Jun 09 2023 04:52:48 GMT+0000 (Coordinated Universal Time) https://creatorapp.zoho.com/sapphireelitetech/datebook#Form:Book_an_Appointment

#deluge #zoho #delugescript #creator #workflow
star

Mon Apr 18 2022 14:12:38 GMT+0000 (Coordinated Universal Time) https://machinelearningmastery.com/how-to-develop-a-convolutional-neural-network-to-classify-photos-of-dogs-and-cats/

#python #direcotry #folder #file #creator
star

Mon Apr 18 2022 05:19:13 GMT+0000 (Coordinated Universal Time) https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator

#python #direcotry #folder #file #creator
star

Mon Apr 18 2022 04:47:18 GMT+0000 (Coordinated Universal Time) https://towardsdatascience.com/dont-use-python-os-library-any-more-when-pathlib-can-do-141fefb6bdb5#:~:text=In%20this%20article%2C%20I%20have,and%20basic%20libraries%20in%20Python.

#python #direcotry #folder #file #creator

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension