roboone_auto_dataset / modules /convert_labelme_nodata.sh
nyxrobotics's picture
Add yolo training
3aa6f4a
raw
history blame contribute delete
652 Bytes
#!/bin/bash
### get script dir
SCRIPT_DIR=$(cd $(dirname $0); pwd)
### Specify the directory containing JSON files
TARGET_DIR=$SCRIPT_DIR/../export_annotated
# Process all JSON files in the target directory
for file in "$TARGET_DIR"/*.json; do
# Step 1: Set imageData to null
jq '.imageData = null' "$file" > tmp && mv tmp "$file"
# Step 2: Check if imagePath contains a subdirectory and modify it if needed
# jq '
# if .imagePath | contains("/") then
# .imagePath |= (split("/") | last)
# else
# .imagePath
# end' "$file" > tmp && mv tmp "$file"
echo "Processed: $file"
done
echo "All files have been processed."