<jupyter_start><jupyter_text>Pre-process the DataAfter loading in each image, you have to standardize the input and output!  --- InputIt's important to make all your images the same size so that they can be sent through the same pipeline of classification steps! Every input image should be in the same format, of the same size, and so on. TODO: Standardize the input images* Resize each image to the desired input size: 600x1100px (hxw).<jupyter_code># This function should take in an RGB image and return a new, standardized version
def standardize_input(image):
    
    ## TODO: Resize image so that all "standard" images are the same size 600x1100 (hxw) 
    standard_im = []
    
    return standard_im<jupyter_output><empty_output><jupyter_text>TODO: Standardize the outputWith each loaded image, you also need to specify the expected output. For this, use binary numerical values 0/1 = night/day.<jupyter_code># Examples: 
# encode("day") should return: 1
# encode("night") should return: 0

def encode(label):
        
    numerical_val = 0
    ## TODO: complete the code to produce a numerical label
    
    return numerical_val<jupyter_output><empty_output><jupyter_text>Construct a `STANDARDIZED_LIST` of input images and output labels.This function takes in a list of image-label pairs and outputs a **standardized** list of resized images and numerical labels.This uses the functions you defined above to standardize the input and output, so those functions must be complete for this standardization to work!<jupyter_code>def standardize(image_list):
    
    # Empty image data array
    standard_list = []

    # Iterate through all the image-label pairs
    for item in image_list:
        image = item[0]
        label = item[1]

        # Standardize the image
        standardized_im = standardize_input(image)

        # Create a numerical label
        binary_label = encode(label)    

        # Append the image, and it's one hot encoded label to the full, processed list of image data 
        standard_list.append((standardized_im, binary_label))
        
    return standard_list

# Standardize all training images
STANDARDIZED_LIST = standardize(IMAGE_LIST)<jupyter_output><empty_output><jupyter_text>Visualize the standardized dataDisplay a standardized image from STANDARDIZED_LIST.<jupyter_code># Display a standardized image and its label

# Select an image by index
image_num = 0
selected_image = STANDARDIZED_LIST[image_num][0]
selected_label = STANDARDIZED_LIST[image_num][1]

# Display image and data about it
## TODO: Make sure the images have numerical labels and are of the same size
plt.imshow(selected_image)
print("Shape: "+str(selected_image.shape))
print("Label [1 = day, 0 = night]: " + str(selected_label))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06719367588932806, 'fraction_numerical': 0.009342436219906576, 'mean_word_length': 4.323135755258126, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '73273', 'license': 'Apache-2.0', 'n_tokens_mistral': 808, 'n_tokens_neox': 768, 'n_words': 311, 'path': 'Image-Representation-and-Classification/Day-Night-Classifier-Part-2.ipynb', 'repo_name': 'RNEnriquez/ComputerVision', 'size': '2783'}