Real-Time Convolutional Neural Network-Based Star Detection and Centroiding Method for CubeSat Star Tracker
Hongrui Zhao, Michael Lembeck, Adrian Zhuang, Riya Shah, Jesse Wei
First clone the repository
git clone -b development --single-branch https://github.com/HongruiZhao/CNNStarDetectCentroid.git
cd CNNStarDetectCentroidCreate a conda environment
conda create -n CNNStarDetectCentroid python=3.8
conda activate CNNStarDetectCentroidInstall pytroch with cuda 11.8
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu118Install other python packages
pip install matplotlib opencv-python scipy pandas tqdm thop gdownFinally install tensorboard
conda install tensorboardDownload our nightsky test video video_Test3.npy recorded with MT9V022 camera
cd hardware_experiment
mkdir saved_results
cd saved_results
gdown --id 1iFCgP53cGZ1if_lJWfbFz7qWKfQnFRJI
cd ..- For more non straylight videos, change
idto1GxRY8bjWUDtSBRQuXRqOdqgUGGVbaXm_or1d-5s3l1tqr7-LotzIVaYLj3xz3nSUDY-. 1MKtcN-BGVzJCeHnqVky1nkWy64VJiUinfor stralight video.1AwpNSWLYxyYel-cjeH1Zpg2WJRxKS88Dfor moonlight video. It does not work very well since the camera was moving around during the recording.
cd data_generation
gdown --id 1_uvcg0AcxmWhJoxbO5dH1Y51mUlNPW3R
unzip dark_frames_straylight.zip This will download two sets of dark frames: dark_frames_Oct19 which only contains noise frames without straylight, and dark_frames_straylight.
python main_generate_data.py --data 1 --parent_dir "./training_data" --dark_frames_dir "./dark_frames_straylight"This will generate and save 2500 training images, 500 evaluation images, and 500 test images into training_data folder using the dark frames from dark_frames_straylight.
cd training
python training_stepLR.py --trial 1 Run with video_Test3.npy
python main_detection_centroiding.py --mode NN --input video --video_file video_Test3.npy- By default it will run our trained model
hardware_experiment/saved_models/MobileUNet_B10_50.pt. - If you want to run ELUnet, go into
hardware_experiment/main_detection_centroiding.py, functionmain_video(), and comment out MobileUNet and uncomment ELUNet. - Changing
--modetobaselinewill run the baseline methods defined in functionrun_baseline().
Usehardware_experiment/evaluation.ipynb to get attitude determination accuracy.