示例#1
0
    def read_cropped_image_array(self):
        # Assert Data Exists in GCS Bucket
        folder_exists = mf.gcs_subfolder_exists(bucket_name=self.bucket_name,
                                                subfolder_name=self.class_name)
        assert_msg = f"Data for image class '{self.class_name} doesn't exist. Create it with self.cropped_obj_images_to_gcs() method'"
        assert folder_exists, assert_msg

        # Read and Return Images
        image_save_name = f'{self.processed_bucket_subfolder}{self.class_name}/{self.processed_array_save_name}'
        img_array = mf.read_gcs_numpy_array(bucket_name=self.bucket_name,
                                            file_name=image_save_name)
        return img_array
示例#2
0
from tensorflow.keras.callbacks import LearningRateScheduler, ReduceLROnPlateau
from tensorflow.keras.optimizers import Adam

# Import Project Modules
from src import config_data_processing as cdp
from src import image_manipulation as imm
from src import misc_functions as mf
from src import modeling as m

### Data Processing: Read Cropped Images for Classification
###############################################################################

# Cropped 'Chest of drawers' Images
get_class1 = 'Chest of drawers'
x1 = mf.read_gcs_numpy_array(
    bucket_name=cdp.config_source_bucket_name,
    file_name=f'processed_files/{get_class1}/train_images_cropped.npy')
plt.imshow(x1[0])

# Cropped 'Fireplace' Images
get_class2 = 'Fireplace'
x2 = mf.read_gcs_numpy_array(
    bucket_name=cdp.config_source_bucket_name,
    file_name=f'processed_files/{get_class2}/train_images_cropped.npy')
plt.imshow(x2[0])

# Cropped 'Sofa bed' Images
get_class3 = 'Sofa bed'
x3 = mf.read_gcs_numpy_array(
    bucket_name=cdp.config_source_bucket_name,
    file_name=f'processed_files/{get_class3}/train_images_cropped.npy')