Crude impl of glue layer, not sure anything works
This commit is contained in:
parent
b69727b74f
commit
f059924b75
3 changed files with 66 additions and 8 deletions
|
|
@ -10,6 +10,7 @@ import h5py
|
|||
CWD = os.getcwd()
|
||||
|
||||
def pre_dataset_sh():
|
||||
dataset_name = "ShanghaiTech"
|
||||
root = CWD + "/synchronous/dataset/" + dataset_name + "/"
|
||||
|
||||
part_A_train = os.path.join(root, "part_A_final/train_data", "images")
|
||||
|
|
@ -53,8 +54,7 @@ def pre_dataset_sh():
|
|||
gt_data[:, 0] = gt_data[:, 0] * rate_x
|
||||
gt_data[:, 1] = gt_data[:, 1] * rate_y
|
||||
|
||||
# Compute gt_count from density map (gt_data)
|
||||
# XXX: what does it do exactly?
|
||||
# Compute 0/1 counts from density map
|
||||
kpoint = np.zeros((img_data.shape[0], img_data.shape[1]))
|
||||
for i in range(len(gt_data)):
|
||||
if ( int(gt_data[i][1]) < img_data.shape[0]
|
||||
|
|
@ -65,15 +65,14 @@ def pre_dataset_sh():
|
|||
root_path = img_path.split("IMG_")[0].replace("images", "images_crop")
|
||||
|
||||
# Likewise, we do not crop to patched sequences here...
|
||||
# Skip directly to saving fixed-size data & gt_count.
|
||||
# Skip directly to saving fixed-size data & kpoint.
|
||||
img_path = img_path.replace("images", "images_crop")
|
||||
cv2.imwrite(img_path, img_data)
|
||||
gt_count = np.sum(kpoint)
|
||||
with h5py.File(
|
||||
img_path.replace('.jpg', '.h5').replace('images', 'gt_density_map'),
|
||||
'w'
|
||||
mode='w'
|
||||
) as hf:
|
||||
hf["gt_count"] = gt_count
|
||||
hf["kpoint"] = kpoint
|
||||
|
||||
|
||||
def make_npydata():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue