请问为什么train_label是20张图,train_data是5张?这样的话如何计算loss?
yanmengyao129 opened this issue · 2 comments
yanmengyao129 commented
代码是训练ConvLSTM的train_and_test函数部分:
for itera in tqdm(range(1, max_iterations+1)):
lr_scheduler.step()
train_batch, train_mask, sample_datetimes, _ = \
train_hko_iter.sample(batch_size=batch_size)
train_batch = torch.from_numpy(train_batch.astype(np.float32)).to(cfg.GLOBAL.DEVICE) / 255.0
train_data = train_batch[:IN_LEN, ...]
train_label = train_batch[IN_LEN:IN_LEN + OUT_LEN, ...]
mask = torch.from_numpy(train_mask[IN_LEN:IN_LEN + OUT_LEN, ...].astype(int)).to(cfg.GLOBAL.DEVICE)
Hzzone commented
用5张图预测未来的20张图,所以label是20
yanmengyao129 commented
用5张图预测未来的20张图,所以label是20
@Hzzone 嗯嗯,这个我理解的。但想不通的是,convLSTM这个设置不是相当于是输入五张输出五张的嘛,为啥能输出20张呀?
`# build model
convlstm_encoder_params = [
[
OrderedDict({'conv1_leaky_1': [1, 8, 7, 5, 1]}),
OrderedDict({'conv2_leaky_1': [64, 192, 5, 3, 1]}),
OrderedDict({'conv3_leaky_1': [192, 192, 3, 2, 1]}),
],
[
ConvLSTM(input_channel=8, num_filter=64, b_h_w=(batch_size, 96, 96),
kernel_size=3, stride=1, padding=1),
ConvLSTM(input_channel=192, num_filter=192, b_h_w=(batch_size, 32, 32),
kernel_size=3, stride=1, padding=1),
ConvLSTM(input_channel=192, num_filter=192, b_h_w=(batch_size, 16, 16),
kernel_size=3, stride=1, padding=1),
]
]
convlstm_forecaster_params = [
[
OrderedDict({'deconv1_leaky_1': [192, 192, 4, 2, 1]}),
OrderedDict({'deconv2_leaky_1': [192, 64, 5, 3, 1]}),
OrderedDict({
'deconv3_leaky_1': [64, 8, 7, 5, 1],
'conv3_leaky_2': [8, 8, 3, 1, 1],
'conv3_3': [8, 1, 1, 1, 0]
}),
],
[
ConvLSTM(input_channel=192, num_filter=192, b_h_w=(batch_size, 16, 16),
kernel_size=3, stride=1, padding=1),
ConvLSTM(input_channel=192, num_filter=192, b_h_w=(batch_size, 32, 32),
kernel_size=3, stride=1, padding=1),
ConvLSTM(input_channel=64, num_filter=64, b_h_w=(batch_size, 96, 96),
kernel_size=3, stride=1, padding=1),
]
]