Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANet datatools #190

Merged
merged 15 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
filename_tmpl='flow_{}_{:05d}.jpg',
with_offset=True,
modality='Flow',
start_index=0,
innerlee marked this conversation as resolved.
Show resolved Hide resolved
pipeline=train_pipeline),
val=dict(
type=dataset_type,
Expand All @@ -88,6 +89,7 @@
filename_tmpl='flow_{}_{:05d}.jpg',
with_offset=True,
modality='Flow',
start_index=0,
pipeline=val_pipeline),
test=dict(
type=dataset_type,
Expand All @@ -96,6 +98,7 @@
filename_tmpl='flow_{}_{:05d}.jpg',
with_offset=True,
modality='Flow',
start_index=0,
pipeline=test_pipeline))
# optimizer
optimizer = dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.0001)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
filename_tmpl='flow_{}_{:05d}.jpg',
with_offset=True,
modality='Flow',
start_index=0,
pipeline=train_pipeline),
val=dict(
type=dataset_type,
Expand All @@ -88,6 +89,7 @@
filename_tmpl='flow_{}_{:05d}.jpg',
with_offset=True,
modality='Flow',
start_index=0,
pipeline=val_pipeline),
test=dict(
type=dataset_type,
Expand All @@ -96,6 +98,7 @@
filename_tmpl='flow_{}_{:05d}.jpg',
with_offset=True,
modality='Flow',
start_index=0,
pipeline=test_pipeline))
# optimizer
optimizer = dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.0001)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,23 @@
data_prefix=data_root,
pipeline=train_pipeline,
with_offset=True,
start_index=0,
filename_tmpl='image_{:05d}.jpg'),
val=dict(
type=dataset_type,
ann_file=ann_file_val,
data_prefix=data_root_val,
pipeline=val_pipeline,
with_offset=True,
start_index=0,
filename_tmpl='image_{:05d}.jpg'),
test=dict(
type=dataset_type,
ann_file=ann_file_test,
data_prefix=data_root_val,
pipeline=test_pipeline,
with_offset=True,
start_index=0,
filename_tmpl='image_{:05d}.jpg'))
# optimizer
optimizer = dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.0001)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,23 @@
data_prefix=data_root,
pipeline=train_pipeline,
with_offset=True,
start_index=0,
filename_tmpl='image_{:05d}.jpg'),
val=dict(
type=dataset_type,
ann_file=ann_file_val,
data_prefix=data_root_val,
pipeline=val_pipeline,
with_offset=True,
start_index=0,
filename_tmpl='image_{:05d}.jpg'),
test=dict(
type=dataset_type,
ann_file=ann_file_test,
data_prefix=data_root_val,
pipeline=test_pipeline,
with_offset=True,
start_index=0,
filename_tmpl='image_{:05d}.jpg'))
# optimizer
optimizer = dict(type='SGD', lr=0.001, momentum=0.9, weight_decay=0.0001)
Expand Down
8 changes: 4 additions & 4 deletions mmaction/datasets/ssn_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ def evaluate(self,
plain_detections = {}
for class_idx in range(len(detections)):
detection_list = []
for vid, dets in detections[class_idx].items():
detection_list.extend([[vid, class_idx] + x[:3]
for video, dets in detections[class_idx].items():
detection_list.extend([[video, class_idx] + x[:3]
for x in dets.tolist()])
plain_detections[class_idx] = detection_list

Expand Down Expand Up @@ -500,15 +500,15 @@ def get_all_gts(self):
"""Fetch groundtruth instances of the entire dataset."""
gts = {}
for video_info in self.video_infos:
vid = video_info['video_id']
video = video_info['video_id']
for gt in video_info['gts']:
class_idx = gt.label - 1
# gt_info: [relative_start, relative_end]
gt_info = [
gt.start_frame / video_info['total_frames'],
gt.end_frame / video_info['total_frames']
]
gts.setdefault(class_idx, {}).setdefault(vid,
gts.setdefault(class_idx, {}).setdefault(video,
[]).append(gt_info)

return gts
Expand Down
201 changes: 201 additions & 0 deletions tools/data/activitynet/action_name.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
action
Applying sunscreen
Arm wrestling
Assembling bicycle
BMX
Baking cookies
Baton twirling
Beach soccer
Beer pong
Blow-drying hair
Blowing leaves
Playing ten pins
Braiding hair
Building sandcastles
Bullfighting
Calf roping
Camel ride
Canoeing
Capoeira
Carving jack-o-lanterns
Changing car wheel
Cleaning sink
Clipping cat claws
Croquet
Curling
Cutting the grass
Decorating the Christmas tree
Disc dog
Doing a powerbomb
Doing crunches
Drum corps
Elliptical trainer
Doing fencing
Fixing the roof
Fun sliding down
Futsal
Gargling mouthwash
Grooming dog
Hand car wash
Hanging wallpaper
Having an ice cream
Hitting a pinata
Hula hoop
Hurling
Ice fishing
Installing carpet
Kite flying
Kneeling
Knitting
Laying tile
Longboarding
Making a cake
Making a lemonade
Making an omelette
Mooping floor
Painting fence
Painting furniture
Peeling potatoes
Plastering
Playing beach volleyball
Playing blackjack
Playing congas
Playing drums
Playing ice hockey
Playing pool
Playing rubik cube
Powerbocking
Putting in contact lenses
Putting on shoes
Rafting
Raking leaves
Removing ice from car
Riding bumper cars
River tubing
Rock-paper-scissors
Rollerblading
Roof shingle removal
Rope skipping
Running a marathon
Scuba diving
Sharpening knives
Shuffleboard
Skiing
Slacklining
Snow tubing
Snowboarding
Spread mulch
Sumo
Surfing
Swimming
Swinging at the playground
Table soccer
Throwing darts
Trimming branches or hedges
Tug of war
Using the monkey bar
Using the rowing machine
Wakeboarding
Waterskiing
Waxing skis
Welding
Drinking coffee
Zumba
Doing kickboxing
Doing karate
Tango
Putting on makeup
High jump
Playing bagpipes
Cheerleading
Wrapping presents
Cricket
Clean and jerk
Preparing pasta
Bathing dog
Discus throw
Playing field hockey
Grooming horse
Preparing salad
Playing harmonica
Playing saxophone
Chopping wood
Washing face
Using the pommel horse
Javelin throw
Spinning
Ping-pong
Making a sandwich
Brushing hair
Playing guitarra
Doing step aerobics
Drinking beer
Playing polo
Snatch
Paintball
Long jump
Cleaning windows
Brushing teeth
Playing flauta
Tennis serve with ball bouncing
Bungee jumping
Triple jump
Horseback riding
Layup drill in basketball
Vacuuming floor
Cleaning shoes
Doing nails
Shot put
Fixing bicycle
Washing hands
Ironing clothes
Using the balance beam
Shoveling snow
Tumbling
Using parallel bars
Getting a tattoo
Rock climbing
Smoking hookah
Shaving
Getting a piercing
Springboard diving
Playing squash
Playing piano
Dodgeball
Smoking a cigarette
Sailing
Getting a haircut
Playing lacrosse
Cumbia
Tai chi
Painting
Mowing the lawn
Shaving legs
Walking the dog
Hammer throw
Skateboarding
Polishing shoes
Ballet
Hand washing clothes
Plataform diving
Playing violin
Breakdancing
Windsurfing
Hopscotch
Doing motocross
Mixing drinks
Starting a campfire
Belly dance
Removing curlers
Archery
Volleyball
Playing water polo
Playing racquetball
Kayaking
Polishing forniture
Playing kickball
Using uneven bars
Washing dishes
Pole vault
Playing accordion
Playing badminton
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def parse_args():
parser.add_argument('--rgb', default='', help='rgb feature root')
parser.add_argument('--flow', default='', help='flow feature root')
parser.add_argument('--dest', default='', help='dest root')
parser.add_argument('--output-format', default='pkl', help='clip length')
parser.add_argument('--output-format', default='csv')
args = parser.parse_args()
return args

Expand Down Expand Up @@ -64,12 +64,13 @@ def pool_feature(data, num_proposals=100, num_sample_bins=3, pool_type='mean'):

def merge_feat(name):
# concatenate rgb feat and flow feat for a single sample
global args
rgb_feat = load(osp.join(args.rgb, name))
flow_feat = load(osp.join(args.flow, name))
rgb_feat = pool_feature(rgb_feat)
flow_feat = pool_feature(flow_feat)
feat = np.concatenate([rgb_feat, flow_feat], axis=-1)
if not osp.exists(args.dest):
os.system(f'mkdir -p {args.dest}')
if args.output_format == 'pkl':
dump(feat, osp.join(args.dest, name))
elif args.output_format == 'csv':
Expand Down
Loading