Skip to content

Instantly share code, notes, and snippets.

@gb96
Created January 23, 2022 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gb96/26cfd87cb3372da91f50614b39bd1f14 to your computer and use it in GitHub Desktop.
Save gb96/26cfd87cb3372da91f50614b39bd1f14 to your computer and use it in GitHub Desktop.
YOLOv5 Training -- Remove all validation images larger than 80000 bytes and also corresponding labels
# Windows PowerShell script for removing validation images that meet some condition.
# Whenever an image is removed we also remove the corresponding annotations file
Get-ChildItem -Path .\valid\images -Recurse | ForEach-Object{
if ($_.Length -gt 80000){
Remove-Item ".\valid\images\$_" -Force
Remove-Item ".\valid\labels\$_".Replace(".jpg", ".txt") -Force
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment