Skip to content

Commit

Permalink
no important change
Browse files Browse the repository at this point in the history
  • Loading branch information
okankop committed Jan 14, 2019
1 parent aba3ccb commit 81803a5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
6 changes: 5 additions & 1 deletion opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ def parse_opts_online():
parser.add_argument('--sample_size', default=112, type=int, help='Height and width of inputs')
parser.add_argument('--sample_duration_det', default=16, type=int, help='Temporal duration of inputs')
parser.add_argument('--sample_duration_clf', default=16, type=int, help='Temporal duration of inputs')

parser.add_argument(
'--n_val_samples',
default=3,
type=int,
help='Number of validation samples for each activity')
parser.add_argument('--initial_scale', default=1.0, type=float, help='Initial scale for multiscale cropping')
parser.add_argument('--n_scales', default=5, type=int, help='Number of scales for multiscale cropping')
parser.add_argument('--scale_step', default=0.84089641525, type=float, help='Scale step for multiscale cropping')
Expand Down
13 changes: 8 additions & 5 deletions real_time_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def load_models(opt):
opt.model_depth = opt.model_depth_det
opt.modality = opt.modality_det
opt.resnet_shortcut = opt.resnet_shortcut_det
opt.resnext_cardinality = opt.resnext_cardinality_det
opt.n_classes = opt.n_classes_det
opt.n_finetune_classes = opt.n_finetune_classes_det

Expand Down Expand Up @@ -340,7 +341,7 @@ def load_models(opt):
new_row.append(path)
start_frame = int(16)
new_row.append(start_frame)
max_i = len(list(enumerate(test_loader))) -1
# max_i = len(list(enumerate(test_loader))) -1
for i, (inputs, targets) in enumerate(test_loader):
if (i %100) == 0 :
print(i)
Expand All @@ -350,11 +351,11 @@ def load_models(opt):
with torch.no_grad():
inputs = Variable(inputs)
targets = Variable(targets)
if opt.modality1 == 'RGB':
if opt.modality_det == 'RGB':
inputs_det = inputs[:,:-1,-opt.sample_duration_det:,:,:]
elif opt.modality1 == 'Depth':
elif opt.modality_det == 'Depth':
inputs_det = inputs[:,-1,-opt.sample_duration_det:,:,:].unsqueeze(1)
elif opt.modality1 =='RGB-D':
elif opt.modality_det =='RGB-D':
inputs_det = inputs[:,:,-opt.sample_duration_det:,:,:]

outputs_det = detector(inputs_det)
Expand Down Expand Up @@ -383,6 +384,7 @@ def load_models(opt):
prob1 = det_selected_queue[prediction_det]

if prediction_det == 1:

if opt.modality_clf == 'RGB':
inputs_clf = inputs[:,:-1,:,:,:]
elif opt.modality_clf == 'Depth':
Expand All @@ -391,6 +393,7 @@ def load_models(opt):
inputs_clf = inputs[:,:,:,:,:]

outputs_clf = classifier(inputs_clf)

outputs_clf = F.softmax(outputs_clf,dim=1)
outputs_clf = outputs_clf.cpu().numpy()[0].reshape(-1,)

Expand Down Expand Up @@ -442,7 +445,7 @@ def load_models(opt):


#pdb.set_trace()
if passive_count >= opt.det_threshold or i == max_i:
if passive_count >= opt.det_threshold:
active = False
else:
active = True
Expand Down
2 changes: 1 addition & 1 deletion results/opts.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"mean": [114.7748, 107.7354, 99.475], "resume_path_det": "MyRes3D-Ahmet/report/egogesture_resnetl_10_Depth_8_9939.pth", "clf_strategy": "raw", "resnext_cardinality_det": 32, "wide_resnet_k_clf": 2, "model_depth_clf": 101, "std": [38.7568578, 37.88248729, 40.02898126], "sample_duration_clf": 32, "det_queue_size": 4, "modality": "Depth", "det_threshold": 1, "stride_len": 1, "std_norm": false, "n_scales": 5, "batch_size": 1, "dataset": "egogesture", "sample_size": 112, "manual_seed": 1, "train_crop": "random", "scale_step": 0.84089641525, "n_classes": 2, "no_softmax_in_test": false, "n_finetune_classes_det": 2, "clf_threshold_pre": 2, "clf_queue_size": 2, "annotation_path": "/Users/A.Gunduz/MyRes3D-Ahmet/annotation_EgoGesture/egogestureall.json", "sample_duration": 8, "model": "resnetl", "n_finetune_classes": 2, "resume_path_clf": "MyRes3D-Ahmet/report/egogesture_resnext_101_Depth_32_9403.pth", "resnet_shortcut_det": "A", "norm_value": 1, "initial_scale": 1.0, "modality_clf": "Depth", "clf_threshold_final": 1, "n_threads": 16, "det_strategy": "raw", "arch": "resnetl-10", "whole_path": "Subject09/Scene6/Color/rgb1", "wide_resnet_k_det": 2, "n_classes_det": 2, "resnext_cardinality_clf": 32, "modality_det": "Depth", "test_subset": "test", "sample_duration_det": 8, "n_classes_clf": 83, "model_depth": 10, "scale_in_test": 1.0, "n_finetune_classes_clf": 83, "mean_dataset": "activitynet", "ft_begin_index": 0, "resnet_shortcut": "A", "store_name": "model", "scales": [1.0, 0.84089641525, 0.7071067811803005, 0.5946035574934808, 0.4999999999911653], "video_path": "/Users/A.Gunduz/Desktop/EgoGesture/images", "root_path": "/Users/A.Gunduz/", "model_clf": "resnext", "pretrain_path": "", "resnet_shortcut_clf": "B", "no_cuda": true, "model_det": "resnetl", "no_mean_norm": false, "crop_position_in_test": "c", "result_path": "/Users/A.Gunduz/Desktop/Real-time-GesRec/results", "resume_path": "/Users/A.Gunduz/MyRes3D-Ahmet/report/egogesture_resnetl_10_Depth_8_9939.pth", "model_depth_det": 10}
{"root_path": "/usr/home/kop/", "video_path": "/data2/EgoGesture/images", "annotation_path": "/usr/home/kop/Real-time-GesRec/annotation_EgoGesture/egogestureall_but_None.json", "result_path": "/usr/home/kop/Real-time-GesRec/results", "store_name": "model", "modality": "RGB-D", "dataset": "egogesture", "n_classes": 83, "n_finetune_classes": 83, "sample_size": 112, "sample_duration": 32, "initial_scale": 1.0, "n_scales": 5, "scale_step": 0.84089641525, "train_crop": "random", "learning_rate": 0.01, "lr_steps": [10, 25, 50, 80, 100], "momentum": 0.9, "dampening": 0.9, "weight_decay": 0.001, "mean_dataset": "activitynet", "no_mean_norm": false, "std_norm": false, "nesterov": false, "optimizer": "sgd", "lr_patience": 10, "batch_size": 8, "n_epochs": 100, "begin_epoch": 1, "n_val_samples": 1, "resume_path": "", "pretrain_path": "", "ft_begin_index": 0, "no_train": false, "no_val": false, "test": false, "test_subset": "test", "train_validate": false, "scale_in_test": 1.0, "crop_position_in_test": "c", "no_softmax_in_test": false, "no_cuda": false, "n_threads": 16, "checkpoint": 1, "no_hflip": false, "norm_value": 1, "model": "c3d", "model_depth": 10, "resnet_shortcut": "B", "wide_resnet_k": 2, "resnext_cardinality": 32, "manual_seed": 1, "weighted": false, "scales": [1.0, 0.84089641525, 0.7071067811803005, 0.5946035574934808, 0.4999999999911653], "arch": "c3d-10", "mean": [114.7748, 107.7354, 99.475], "std": [38.7568578, 37.88248729, 40.02898126]}
11 changes: 5 additions & 6 deletions run_offline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ python main.py \
--video_path /data2/EgoGesture/images \
--annotation_path ~/Real-time-GesRec/annotation_EgoGesture/egogestureall_but_None.json\
--result_path ~/Real-time-GesRec/results \
--pretrain_path ~/MyRes3D-Ahmet/models/jester_c3d_10_RGB_32_9414.pth\
--dataset egogesture \
--sample_duration 32 \
--learning_rate 0.01 \
--model c3d \
--learning_rate 0.01 \
--model c3d \
--model_depth 10 \
--resnet_shortcut B \
--batch_size 8 \
--n_classes 27 \
--n_classes 83 \
--n_finetune_classes 83 \
--n_threads 16 \
--checkpoint 1 \
--modality RGB-D \
--train_crop random \
--n_val_samples 1 \
--test_subset test \
--n_epochs 100 \
--n_epochs 100 \

6 changes: 2 additions & 4 deletions run_online.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
python real_time_test.py \
--root_path ~/\
--video_path Desktop/EgoGesture/images \
--video_path /data2/EgoGesture/images \
--whole_path Subject09/Scene6/Color/rgb1 \
--annotation_path MyRes3D-Ahmet/annotation_EgoGesture/egogestureall.json \
--resume_path_det MyRes3D-Ahmet/report/egogesture_resnetl_10_Depth_8_9939.pth \
--resume_path_clf MyRes3D-Ahmet/report/egogesture_resnext_101_Depth_32_9403.pth \
--result_path Desktop/Real-time-GesRec/results \
--result_path MyRes3D-Ahmet/results \
--dataset egogesture \
--sample_duration_det 8 \
--sample_duration_clf 32 \
Expand Down Expand Up @@ -34,6 +34,4 @@ python real_time_test.py \
--clf_threshold_pre 2 \
--clf_threshold_final 1 \
--stride_len 1 \
--no_cuda \


0 comments on commit 81803a5

Please sign in to comment.