Example #1
0
import numpy as np
import tensorflow as tf
import pydotplus
import cv2

from model.OnyxRoundSegmentation import OnyxRoundSegmentation
from tensorflow.keras.models import model_from_json
from util.opendl_segmentation_dataloader import opendl_segmentation_dataloader

print(tf.__version__)

loader_train = opendl_segmentation_dataloader(
    'C://Users//gellston//Desktop//FinalChassisRoundAugmentation//')
loader_test = opendl_segmentation_dataloader(
    'C://Users//gellston//Desktop//FinalChassisRoundAugmentation//')

learning_rate = 0.003
batch_size = 10
sample_size = loader_train.size()
total_batch = int(sample_size / batch_size)
target_accuracy = 0.982

model = OnyxRoundSegmentation(learning_rate=learning_rate)
tf.keras.utils.plot_model(
    model.get_model(),
    to_file=
    'C:\\Github\\DeepLearningStudy\\trained_model\\ChassisRoundSegmentation.png',
    show_shapes=True,
    show_layer_names=True)
for epoch in range(500):
    average_cost = 0
import numpy as np
import tensorflow as tf
import pydotplus
import cv2

from model.OnyxLineSegmentation import OnyxLineSegmentation
from tensorflow.keras.models import model_from_json
from util.opendl_segmentation_dataloader import opendl_segmentation_dataloader

print(tf.__version__)

loader_train = opendl_segmentation_dataloader(
    'C://Users//gellston//Desktop//FinalOnyxLineAugmentation//')
loader_test = opendl_segmentation_dataloader(
    'C://Users//gellston//Desktop//FinalOnyxLineAugmentation//')

learning_rate = 0.002
batch_size = 3
sample_size = loader_train.size()
total_batch = int(sample_size / batch_size)
target_accuracy = 0.992

model = OnyxLineSegmentation(learning_rate=learning_rate)
tf.keras.utils.plot_model(
    model.get_model(),
    to_file=
    'C:\\Github\\DeepLearningStudy\\trained_model\\OnyxLineSegmentation.png',
    show_shapes=True,
    show_layer_names=True)
for epoch in range(500):
    average_cost = 0
Example #3
0
import numpy as np
import tensorflow as tf
import cv2


from model.PCBDefectSegmentationV8 import PCBDefectSegmentationV8
from util.opendl_segmentation_dataloader import opendl_segmentation_dataloader


print(tf.__version__)


loader_train = opendl_segmentation_dataloader('C://Users//gellston//Desktop//PCB_Augmentation_Final_512_Rotation//')
loader_test = opendl_segmentation_dataloader('C://Users//gellston//Desktop//PCB_Augmentation_Final_512_Rotation//')

learning_rate = 0.001
batch_size = 5
sample_size = loader_train.size()
total_batch = int(sample_size / batch_size)
target_accuracy = 0.96

model = PCBDefectSegmentationV8(learning_rate=learning_rate)
tf.keras.utils.plot_model(model.get_model(), to_file='C:\\Github\\DeepLearningStudy\\trained_model\\PCBDefectSegmentation.png', show_shapes=True, show_layer_names=True)
for epoch in range(1000):
    average_cost = 0
    average_accuracy = 0
    for batch in range(total_batch):
        inputs_train, outputs_train = loader_train.load([512, 512, 3], [512, 512, 1], 1, 255, batch_size)
        if inputs_train is None or outputs_train is None:
            break