Skip to content

Commit

Permalink
[WIP] testing data processing run sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
hollydinkel committed Mar 22, 2024
1 parent e4ad082 commit 455bffe
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion astrobee_data_processing_scripts/create_cameras_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
images_dir = f'./data/{args.date}/{args.robot}/bayer/survey{args.survey}'
poses_dir = f'./data/{args.date}/{args.robot}/pose/survey{args.survey}'
poses = sorted(os.listdir(poses_dir))
fastcd_data_dir = f'/home/hollydinkel/change_ws/src/fast_change_detection/example/dataset/{args.date}_{args.robot}_survey{args.survey}'
fastcd_data_dir = f'./fast_change_detection/example/dataset/{args.date}_{args.robot}_survey{args.survey}'

try: os.mkdir(fastcd_data_dir)
except FileExistsError:
Expand Down
6 changes: 3 additions & 3 deletions astrobee_data_processing_scripts/poses_to_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def main():

args = parser.parse_args()

bag_dir = f"./data/{args.date}/{args.robot}/bags/survey{args.survey}"
bag_dir = f"{args.date}/{args.robot}/bags/survey{args.survey}"

output_dir = f"./data/{args.date}/{args.robot}/bayer/survey{args.survey}"
output_dir_poses = f"./data/{args.date}/{args.robot}/pose/survey{args.survey}"
output_dir = f"{args.date}/{args.robot}/bayer/survey{args.survey}"
output_dir_poses = f"{args.date}/{args.robot}/pose/survey{args.survey}"
try: os.mkdir(output_dir)
except FileExistsError:
print(f"{output_dir} already exists!")
Expand Down
4 changes: 2 additions & 2 deletions astrobee_data_processing_scripts/process_sequential_poses.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

args = parser.parse_args()

img_dir = f"./data/{args.date}/{args.robot}/bayer/survey{args.survey}"
pose_dir = f"./data/{args.date}/{args.robot}/pose/survey{args.survey}"
img_dir = f"{args.date}/{args.robot}/bayer/survey{args.survey}"
pose_dir = f"{args.date}/{args.robot}/pose/survey{args.survey}"

pose_list = sorted([int(os.path.splitext(file)[0]) for file in os.listdir(pose_dir)])
img_list = sorted([int(os.path.splitext(file)[0]) for file in os.listdir(img_dir)])
Expand Down
36 changes: 21 additions & 15 deletions process_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,35 @@ export CATKIN_WS=$HOME/test_ws/src
export ASTROBEE=$HOME/astrobee
export ASTROBEE_CHANGE_DETECTION=$CATKIN_WS/astrobee_change_detection
export DATA=$ASTROBEE_CHANGE_DETECTION/data
export FASTCD=$ASTROBEE_CHANGE_DETECTION/fast_change_detection
export DATE=20230419
export ROBOT=bsharp
source $ASTROBEE/devel/setup.bash

mkdir $DATA
# mkdir $DATA

# Install dependencies
apt-get update
apt-get install -y python3-pip
pip install numpy --upgrade
pip install gdown pyquaternion pandas
# # Install dependencies
# apt-get update
# apt-get install -y python3-pip
# pip install numpy --upgrade
# pip install gdown pyquaternion pandas

# Download data
cd $DATA && gdown https://drive.google.com/uc?id=1qNCRl9XceINrHLFUp4pBti9I4oJO2zf1
unzip data.zip
rm $DATA/data.zip
# # Download data
# cd $DATA && gdown https://drive.google.com/uc?id=1qNCRl9XceINrHLFUp4pBti9I4oJO2zf1
# unzip data.zip
# cp data/ ../
# rm -rf data/
# rm $DATA/data.zip

for SURVEY_NUMBER in 1 2 3 4
for SURVEY_NUMBER in 2 3 4
do
export SURVEY=$SURVEY_NUMBER
cd $DATA && python3 $ASTROBEE_CHANGE_DETECTION/astrobee_data_processing_scripts/poses_to_file.py $SURVEY $DATE $ROBOT
rosrun sparse_mapping process_sequential_images.py $DATA/$DATE/$ROBOT/bayer/survey$SURVEY $ASTROBEE/src/astrobee/config
cd $DATA && python3 $ASTROBEE_CHANGE_DETECTION/astrobee_data_processing_scripts/process_sequential_poses.py $SURVEY $DATE $ROBOT
cd $DATA/$DATE/$ROBOT/bayer/survey$SURVEY
ls -v | nl -v 0 | while read n f; do mv -n "$f" "Image$n.JPG"; done
rosrun sparse_mapping process_sequential_images.py $DATA/$DATE/$ROBOT/bayer/survey$SURVEY $ASTROBEE/src/astrobee
mv $DATA/$DATE/$ROBOT/bayer/survey$SURVEY/0/* $DATA/$DATE/$ROBOT/bayer/survey$SURVEY/
rm -rf $DATA/$DATE/$ROBOT/bayer/survey$SURVEY/0 $DATA/$DATE/$ROBOT/bayer/survey$SURVEY/invalid $DATA/$DATE/$ROBOT/bayer/survey$SURVEY/rotation
cd $DATA && python3 $ASTROBEE_CHANGE_DETECTION/astrobee_data_processing_scripts/process_sequential_poses.py $SURVEY $DATE $ROBOT && rm *.txt
cd $DATA/$DATE/$ROBOT/bayer/survey$SURVEY && ls -v | nl -v 0 | while read n f; do mv -n "$f" "Image$n.JPG"; done
cp -r $DATA/$DATE/$ROBOT/bayer/survey$SURVEY $FASTCD/
cd $ASTROBEE_CHANGE_DETECTION && python3 astrobee_data_processing_scripts/create_cameras_xml.py $SURVEY $DATE $ROBOT
done

0 comments on commit 455bffe

Please sign in to comment.