Skip to content

Instantly share code, notes, and snippets.

@brianlan
Created February 11, 2020 06:59
Show Gist options
  • Save brianlan/13d018da736fdf838ada2a8d9ff87be5 to your computer and use it in GitHub Desktop.
Save brianlan/13d018da736fdf838ada2a8d9ff87be5 to your computer and use it in GitHub Desktop.
create_path_label_csv_from_folder
cd /datadrive2/project_data/CCTH/sku_classify/train/cropped_images
find . -name "*.jpg" > /tmp/train.txt
cat /tmp/train.txt | awk -F/ '{print $2}' > /tmp/label.txt
cat /tmp/train.txt | sed 's/^\./cropped_images/g' > /tmp/train_tmp.txt
echo -e "name,label\n$(paste -d "," /tmp/train_tmp.txt /tmp/label.txt)" > /tmp/train.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment