Cubesat challenge considerations deep dive

clintonbeye 7 views 21 slides Mar 06, 2025
Slide 1
Slide 1 of 21
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21

About This Presentation

Cubesat challenge considerations


Slide Content

CUBESAT CHALLENGE CONSIDERATIONS

Outline 1. General considerations 2. Preprocessing and feature selection 3. Algorithm design 4. Training and testing

1. General considerations ChatGPT is your friend—Use it to create new code quickly. Phrase your queries well. The goal is to design an algorithm with high accuracy and low computation. Two possible strategies are: Start simple and improve the accuracy or Start accurate and decrease computation. Do some preliminary calculations to evaluate tradeoffs and make intelligent preliminary choices. Streamline your test procedures. The faster your testing, the more options you can explore. Look at your training diagnostics, and understand what they are telling you.

2. Preprocessing and feature selection Reducing the input data can greatly reduce the processing time You want to retain input data that gives the most relevant information Do you really need all 3 channels? Can you reduce the resolution? Can you get away with taking a section (say ¼) of the picture? Take only stripes or corners (to catch missing data)? Use intensity distribution only? Take quantiles? To answer these questions, you should look at the data.

ChatGPT scripts to generate exploratory code. I have a numpy file train_images.npy that contains images, and another numpy file train_labels.npy that contains corresponding labels. There are five different labels. I want to select 1000 images and their corresponding labels. The images should be balanced among the five classes. I want to store the images in selected_images.npy and the corresponding labels in selected_labels.npy I have a file selected_images.npy containing several images. Each image belongs to one of five classes. The corresponding classes are in selected_labels.npy. I want a python program that will randomly select one image of each type and display them side by side in a row of 5 images

All channels vs. channel 0 (Note missing data AND blurry: potential issue with classification)

Select only four 100 x 100 corners (reduces data by 75%)

Histogram of intensities, one channel I have a single-channel image. I want to plot the histogram of intensities as a subplot within an array of plots. I want to set the x axis to run from 0 to the 99th quantile. I also want to mark the deciles on the x axis.

3. ALGORITHM DESIGN: conventional ML or deep learning ?

Conventional ML algorithm design Intelligent preprocessing and feature selection are key. You probably don’t want to do this with the entire image. because conventional ML typically uses flattened input that does not preserve spatial relationships. Distribution quantiles are a good possibility (include 0 as one of your categories). Consider using edge detection filters, such as Sobel operator, Canny edge detection, Laplacian variance. The good-quality images will have sharper edges These require that you install the OpenCV package Some ML algorithms run much faster than others (for example, logistic regression is very fast.)You can describe the problem to ChatGPT and get suggestions as to which algorithms are more appropriate. You can use more than one algorithm (some may be better than others for different classes). Algorithms can be in sequence or in parallel.

Notebook 3 ML critique Why not take single channel instead of grayscaling? (minor computational savings) Downscaling may help, just not so extreme Flattening is necessary because conventional ML does not preserve spatial relations. Read the documentation: https://scikit-learn.org/1.5/modules/generated/sklearn.linear_model.SGDClassifier.html This implements a linear model (such as linear SVM ( default ) or logistic regression. There are several options for loss function, penalty, etc. which bear consideration.

Deep Learning algorithm design CNN is natural choice for NN type Consider carefully the model structure (hyperparameters): Number of layers For each layer: Kernel size Number of feature maps Stride (this is not used in CubeCatNet, but may really be helpful) Pooling (max or average) Activation function (ReLU is fastest to compute) Make intelligent choices—do preliminary computations

Deep Learning algorithm design To better understand the effect of Number of layers, Kernel size, Number of feature maps please see: https://adamharley.com/nn_vis/cnn/3d.html

CubeCatNet design 3 by 3 kernel, 16 features 2 by 2 max pooling 3 by 3 kernel, 32 features 2 by 2 max pooling 3 by 3 kernel, 64 features 2 by 2 max pooling 3 by 3 kernel, 128 features 2 by 2 max pooling Reduces to 128 numbers Reduces to 5 numbers

CubeCatNet computational complexity 3 by 3 kernel, 16 features on 512 by 512 by 3 input: 3*3*3 multiply-accumulates (MACs) per kernel calculation 16 kernel calculations per location (512-2)*(512-2) locations: Total: 3*3*3*16* (512-2)*(512-2) calculations = 112 MMACs 2 by 2 max pooling reduces to 510/2 by 510/2 locations 3 by 3 kernel, 32 features on 255 by 255 by 16 input: 3*3*16 multiply-accumulates (MACs) per kernel calculation 32 kernel calculations per location (255-2)*(255-2) locations: Total: 3*3*16*32*(253)*(253) calculations = 294 MMACs 2 by 2 max pooling reduces to 252/2 by 252/2 locations 3 by 3 kernel, 64 features on 126 by 126 by 32 input: 3*3*32 multiply-accumulates (MACs) per kernel calculation 64 kernel calculations per location (126-2)*(126-2) locations: Total: 3*3*32*64* (126-2)*(126-2) calculations = 283 MMACs 2 by 2 max pooling reduces to 124/2 by 124/2 locations 3 by 3 kernel, 128 features on 62 by 62 by 64 input: 3*3*16 multiply-accumulates (MACs) per kernel calculation 128 kernel calculations per location (62-2)*(62-2) locations: Total: 3*3*16*32*(255-2)*(255-2) calculations = 294 MMACs 2 by 2 max pooling reduces to 60/2 by 60/2 locations Global average pooling reduces 30 by 30 by 128 to 128 nodes 128 nodes fully connected to 5 nodes: 128*5 MACs

After the first layer 4 nodes collapse into 1 node & node spacing doubles to 2 “Square of influence” around each node has side 4 After the second layer 4 nodes collapse into 1 node & node spacing doubles to 4 “Square of influence” around each node has side 10 After the third layer 4 nodes collapse into 1 node & node spacing doubles to 8 “Square of influence” around each node has side 22 After the fourth layer 4 nodes collapse into 1 node & node spacing doubles to 16 “Square of influence” around each node has side 46 CubeCatNet influence spread

Live worksheet for calculating complexity and influence spread

4. Training and testing—conventional ML Efficient training is the key to algorithm development. The training pipeline should be configured so that you can quickly evaluate and compare algorithms’ performance. For conventional ML algorithms, there should be no problem with using the entire training set. Note however the class imbalance is what produced the over-prediction of Priority in notebook 3. This should not be an issue for algorithms with high accuracy, but you should be aware of the issue. There is some ambiguity with the labels. There are images that have both missing data and noisy, or both missing data and corrupt. If there are very few errors, look at the images that are erroneous and try to understand why they are misclassified.

Training and testing--CNN Efficient training is the key to algorithm development. If you are looking at CNN models that require several minutes for training, consider training on a reduced dataset with balanced classes. Train models multiple times to make sure your results are consistent. This way you can compare quickly across models. Once you have narrowed down to 3 or 4 models, then you can run the full training set on these. Look at your training progress. Accuracy should increase and roughly stabilize, and loss should decrease and stabilize. If not, there is something wrong with your model. If your validation accuracy is very different from your final training accuracy, then you need to investigate why (overfitting or underfitting)

Testing (general) You need to run the final test (Notebook 5) on your final algorithm. Note that “pipeline” in Notebook 5 refers to the complete classification algorithm (including both preprocessing and classification model). It does not refer to the training pipeline. As far as evaluation metrics, the two most important measures are model performance and evaluation time. The memory usage will adapt to the device, and code sizes for even very complicated neural networks are relatively small.

THAT’S ALL, FOLKS Christopher Thron [email protected]
Tags