Skip to content

Commit 10f3fcb

Browse files
committed
add fddb download script
1 parent 1b7d824 commit 10f3fcb

3 files changed

Lines changed: 85 additions & 0 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# FaceAnnotationTool
22

3+
### Testing with FDDB images:
4+
get fddb images and annotations by executing `download_fddb.sh`
5+
6+
7+
38
### TODO:
49
- [x] basic functions
510
- [x] ask for prefix and suffix when load imglist
@@ -10,3 +15,4 @@
1015
- [x] one click after load -> disable load annotation button
1116
- [x] load annotation -> disable load annotation button
1217
- [x] output file function
18+

download_fddb.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
echo "Downloading fddb images"
4+
5+
mkdir fddb && cd fddb
6+
wget http://tamaraberg.com/faceDataset/originalPics.tar.gz
7+
echo "Unzip..."
8+
tar -xzf originalPics.tar.gz
9+
rm -f originalPics.tar.gz
10+
11+
wget http://vis-www.cs.umass.edu/fddb/FDDB-folds.tgz
12+
echo "Unzip..."
13+
tar -xzf FDDB-folds.tgz
14+
rm -f FDDB-folds.tgz
15+
16+
cd ..
17+
python gen_absolute_path.py
18+
19+

gen_absolute_path.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
'''
2+
(By default, this script will be automatically invoked by download_fddb.sh)
3+
4+
Manually invoke this script to generate image list and annotation files with
5+
absolute paths.
6+
7+
Please make sure this script stays aside with a folder fddb which contains
8+
sub-folders: 2002, 2003, FDDB-folds.
9+
10+
Invoke this script again after you move the directory of images.
11+
12+
'''
13+
import os
14+
15+
16+
assert os.path.exists("fddb/2002"), "fddb iamge folder 'fddb/2002' not found"
17+
assert os.path.exists("fddb/2003"), "fddb iamge folder 'fddb/2003' not found"
18+
assert os.path.exists("fddb/FDDB-folds"), "fddb annotation folder 'fddb/FDDB-folds' not found"
19+
20+
os.chdir('fddb')
21+
prefix = os.getcwd()
22+
suffix = ".jpg"
23+
x=os.popen("pwd | sed 's/ /\\ /g'").read().strip()
24+
img_list_files = os.popen("find '{}/FDDB-folds' -name '*[0-9].txt'".format(x)).read().split('\n')
25+
anot_list_files = os.popen("find '{}/FDDB-folds' -name '*List.txt'".format(x)).read().split('\n')
26+
27+
28+
s = ""
29+
for p in img_list_files:
30+
if p == '' :
31+
continue
32+
with open(p,'r') as f:
33+
lines = f.readlines()
34+
lines = [os.path.join(prefix, l.replace('\n','')+suffix) for l in lines]
35+
s += "\n".join(lines)+'\n'
36+
37+
with open("./MergedImagePath.txt",'w') as f:
38+
f.write(s)
39+
40+
s = ""
41+
for p in anot_list_files:
42+
if p == '' :
43+
continue
44+
with open(p,'r') as f:
45+
lines = f.readlines()
46+
47+
lines = [l.replace('\n','') for l in lines]
48+
for i in range(len(lines)):
49+
l = lines[i]
50+
if(len(l.split("/")) == 5):
51+
lines[i] = os.path.join(prefix, l+suffix)
52+
s += '\n'.join(lines)+'\n'
53+
54+
with open("./MergedAnnotations.txt",'w') as f:
55+
f.write(s)
56+
57+
print "Merged image path wrote to: "+os.path.join(os.getcwd(),"MergedImagePath.txt")
58+
print "Merged annotations wrote to: "+os.path.join(os.getcwd(),"MergedAnnotations.txt")
59+
60+

0 commit comments

Comments
 (0)