Closed wwdok closed 3 years ago
My case:
I use 4 print function
print("==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~")
print("preds is {}".format(preds.tolist()))
print("labels is {}".format(labels.tolist()))
num_topks_correct = metrics.topks_correct(preds, labels, (1))
print("preds.size(0) is {}".format(preds.size(0)))
print("num_topks_correct is {}".format(num_topks_correct))
top1_err= [(1.0 - x / preds.size(0)) * 100.0 for x in num_topks_correct][0]
in def train_epoch()
to check preds and labels, part of its output is :
[11/17 15:35:50][INFO] train_net.py: 419: Start epoch: 2
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.03573627024888992], [-0.32597339153289795]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.30879950523376465], [-0.02247714065015316]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[0.05403393507003784], [-0.18906450271606445]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.18617770075798035], [-0.16703137755393982]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[0.10825307667255402], [-0.292312890291214]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.0778438001871109], [-0.07582096755504608]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.30321329832077026], [-0.11427342891693115]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.09245844930410385], [-0.25378167629241943]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.2726392149925232], [0.0589011125266552]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
==============!!!!!!!!!!!!!!!!!!!!!!~~~~~~~~~~~~~~~~~
preds is [[-0.07824113965034485], [-0.22474029660224915]]
labels is [0, 0]
preds.size(0) is 2
num_topks_correct is [tensor(2., device='cuda:0')]
[11/17 15:35:59][INFO] logging.py: 96: json_stats: {"_type": "train_iter", "dt": 0.75530, "dt_data": 0.00388, "dt_net": 0.75142, "epoch": "2/10", "eta": "0:01:20", "gpu_mem": "2.78G", "iter": "10/13", "loss": 0.00000, "lr": 0.00972, "top1_err": 0.00000}
the predition is negtive, is it normal ? i didn't enable DETECTION in yaml.
my yaml is :
TRAIN:
ENABLE: True
DATASET: kinetics
BATCH_SIZE: 2
EVAL_PERIOD: 10
CHECKPOINT_FILE_PATH: "./demo/Kinetics/SLOWFAST_8x8_R50.pkl"
CHECKPOINT_TYPE: caffe2
CHECKPOINT_PERIOD: 1
AUTO_RESUME: True
DATA:
NUM_FRAMES: 32
SAMPLING_RATE: 2
TRAIN_JITTER_SCALES: [256, 320]
TRAIN_CROP_SIZE: 224
TEST_CROP_SIZE: 256
INPUT_CHANNEL_NUM: [3, 3]
PATH_TO_DATA_DIR: "/media/weidawang/DATA/dataset/HMDB51/hmdb51_org/fall_floor"
PATH_LABEL_SEPARATOR: ","
SLOWFAST:
ALPHA: 4
BETA_INV: 8
FUSION_CONV_CHANNEL_RATIO: 2
FUSION_KERNEL_SZ: 7
RESNET:
ZERO_INIT_FINAL_BN: True
WIDTH_PER_GROUP: 64
NUM_GROUPS: 1
DEPTH: 50
TRANS_FUNC: bottleneck_transform
STRIDE_1X1: False
NUM_BLOCK_TEMP_KERNEL: [[3, 3], [4, 4], [6, 6], [3, 3]]
SPATIAL_STRIDES: [[1, 1], [2, 2], [2, 2], [2, 2]]
SPATIAL_DILATIONS: [[1, 1], [1, 1], [1, 1], [1, 1]]
NONLOCAL:
LOCATION: [[[], []], [[], []], [[], []], [[], []]]
GROUP: [[1, 1], [1, 1], [1, 1], [1, 1]]
INSTANTIATION: dot_product
BN:
USE_PRECISE_STATS: True
NUM_BATCHES_PRECISE: 200
SOLVER:
BASE_LR: 0.0125
LR_POLICY: cosine
MAX_EPOCH: 10
MOMENTUM: 0.9
WEIGHT_DECAY: 1e-4
WARMUP_EPOCHS: 34.0
WARMUP_START_LR: 0.01
OPTIMIZING_METHOD: sgd
MODEL:
NUM_CLASSES: 1
ARCH: slowfast
MODEL_NAME: SlowFast
LOSS_FUNC: cross_entropy
DROPOUT_RATE: 0.5
TEST:
ENABLE: True
DATASET: kinetics
BATCH_SIZE: 2
DATA_LOADER:
NUM_WORKERS: 8
PIN_MEMORY: True
NUM_GPUS: 1
NUM_SHARDS: 1
RNG_SEED: 0
OUTPUT_DIR: .
Just as AlexanderMelde said, i need to increase training action classes number more than one.
I print out
stats
in thedef log_epoch_stats(self, cur_epoch):
, they are shown as below: