File data_flow.py changed (mode: 100644) (index 924b307..2d67c33) |
... |
... |
def load_data_shanghaitech_pacnn(img_path, train=True): |
98 |
98 |
target1 = cv2.resize(target, (int(target.shape[1] / 8), int(target.shape[0] / 8)), |
target1 = cv2.resize(target, (int(target.shape[1] / 8), int(target.shape[0] / 8)), |
99 |
99 |
interpolation=cv2.INTER_CUBIC) * 64 |
interpolation=cv2.INTER_CUBIC) * 64 |
100 |
100 |
target2 = cv2.resize(target, (int(target.shape[1] / 16), int(target.shape[0] / 16)), |
target2 = cv2.resize(target, (int(target.shape[1] / 16), int(target.shape[0] / 16)), |
101 |
|
interpolation=cv2.INTER_CUBIC) * 64 *2 |
|
|
101 |
|
interpolation=cv2.INTER_CUBIC) * 256 |
102 |
102 |
target3 = cv2.resize(target, (int(target.shape[1] / 32), int(target.shape[0] / 32)), |
target3 = cv2.resize(target, (int(target.shape[1] / 32), int(target.shape[0] / 32)), |
103 |
|
interpolation=cv2.INTER_CUBIC) * 64 *4 |
|
|
103 |
|
interpolation=cv2.INTER_CUBIC) * 1024 |
104 |
104 |
|
|
105 |
105 |
return img, (target1, target2, target3) |
return img, (target1, target2, target3) |
106 |
106 |
|
|
|
... |
... |
def load_data_ucf_cc50_pacnn(img_path, train=True): |
138 |
138 |
target1 = cv2.resize(target, (int(target.shape[1] / 8), int(target.shape[0] / 8)), |
target1 = cv2.resize(target, (int(target.shape[1] / 8), int(target.shape[0] / 8)), |
139 |
139 |
interpolation=cv2.INTER_CUBIC) * 64 |
interpolation=cv2.INTER_CUBIC) * 64 |
140 |
140 |
target2 = cv2.resize(target, (int(target.shape[1] / 16), int(target.shape[0] / 16)), |
target2 = cv2.resize(target, (int(target.shape[1] / 16), int(target.shape[0] / 16)), |
141 |
|
interpolation=cv2.INTER_CUBIC) * 64 #*2 |
|
|
141 |
|
interpolation=cv2.INTER_CUBIC) * 256 |
142 |
142 |
target3 = cv2.resize(target, (int(target.shape[1] / 32), int(target.shape[0] / 32)), |
target3 = cv2.resize(target, (int(target.shape[1] / 32), int(target.shape[0] / 32)), |
143 |
|
interpolation=cv2.INTER_CUBIC) * 64 #*4 |
|
|
143 |
|
interpolation=cv2.INTER_CUBIC) * 1024 |
144 |
144 |
|
|
145 |
145 |
return img, (target1, target2, target3) |
return img, (target1, target2, target3) |
146 |
146 |
|
|
File visualize_data_loader.py changed (mode: 100644) (index cd7d5eb..b515bbd) |
... |
... |
def visualize_ucf_cc_50_pacnn(): |
34 |
34 |
]), |
]), |
35 |
35 |
train=True, |
train=True, |
36 |
36 |
batch_size=1, |
batch_size=1, |
37 |
|
num_workers=4, dataset_name="ucf_cc_50_pacnn", debug=True), |
|
|
37 |
|
num_workers=4, dataset_name="shanghaitech_pacnn", debug=True), |
38 |
38 |
batch_size=1, num_workers=4) |
batch_size=1, num_workers=4) |
39 |
39 |
|
|
40 |
40 |
img, label = next(iter(train_loader_pacnn)) |
img, label = next(iter(train_loader_pacnn)) |
|
... |
... |
def visualize_ucf_cc_50_pacnn(): |
44 |
44 |
save_density_map(label[0].numpy()[0], os.path.join(saved_folder,"pacnn_loader_density1.png")) |
save_density_map(label[0].numpy()[0], os.path.join(saved_folder,"pacnn_loader_density1.png")) |
45 |
45 |
save_density_map(label[1].numpy()[0], os.path.join(saved_folder,"pacnn_loader_density2.png")) |
save_density_map(label[1].numpy()[0], os.path.join(saved_folder,"pacnn_loader_density2.png")) |
46 |
46 |
save_density_map(label[2].numpy()[0], os.path.join(saved_folder,"pacnn_loader_density3.png")) |
save_density_map(label[2].numpy()[0], os.path.join(saved_folder,"pacnn_loader_density3.png")) |
|
47 |
|
print("count1 ", label[0].numpy()[0].sum()) |
|
48 |
|
print("count2 ", label[1].numpy()[0].sum()) |
|
49 |
|
print("count3 ", label[2].numpy()[0].sum()) |
47 |
50 |
|
|
48 |
51 |
|
|
49 |
52 |
if __name__ == "__main__": |
if __name__ == "__main__": |