Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kth data download and process scripts.
- Loading branch information
Showing
3 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'paths' | ||
|
||
opt = lapp[[ | ||
--imageSize (default 128) size of image | ||
--dataRoot (default '/path/to/data/') data root directory | ||
]] | ||
image_size = opt.imageSize | ||
data_root = opt.dataRoot | ||
if not paths.dir(data_root) then | ||
error(('Error with data directory: %s'):format(data_root)) | ||
end | ||
|
||
classes = {'boxing', 'handclapping', 'handwaving', 'jogging', 'running', 'walking'} | ||
|
||
frame_rate = 25 | ||
|
||
for _, class in pairs(classes) do | ||
print(' ---- ') | ||
print(class) | ||
|
||
for vid in paths.iterfiles(data_root .. '/raw/' .. class) do | ||
print(vid) | ||
local fname = vid:sub(1,-12) | ||
os.execute(('mkdir -p %s/processed/%s/%s'):format(data_root, class, fname)) | ||
os.execute( ('~/tools/ffmpeg-git-20170417-32bit-static/ffmpeg -i %s/raw/%s/%s -r %d -f image2 -s %dx%d %s/processed/%s/%s/image-%%03d_%dx%d.png'):format(data_root, class, vid, frame_rate, image_size, image_size, data_root, class, fname, image_size, image_size)) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
TARGET_DIR=$1 | ||
if [ -z $TARGET_DIR ] | ||
then | ||
echo "Must specify target directory" | ||
else | ||
mkdir $TARGET_DIR/processed | ||
mkdir $TARGET_DIR/raw | ||
URL=http://www.cs.nyu.edu/~denton/datasets/kth.tar.gz | ||
wget $URL -P $TARGET_DIR/processed | ||
tar -zxvf $TARGET_DIR/processed/kth.tar.gz -C $TARGET_DIR/processed/ | ||
rm $TARGET_DIR/processed/kth.tar.gz | ||
|
||
for c in walking jogging running handwaving handclapping boxing | ||
do | ||
URL=http://www.nada.kth.se/cvap/actions/"$c".zip | ||
wget $URL -P $TARGET_DIR/raw | ||
mkdir $TARGET_DIR/raw/$c | ||
unzip $TARGET_DIR/raw/"$c".zip -d $TARGET_DIR/raw/$c | ||
rm $TARGET_DIR/raw/"$c".zip | ||
done | ||
|
||
fi |