Generate multiple images with random ground truth and predicted instance and semantic segmentation data. To make the images realistic, and to ensure that the instances form a PARTITION of the image, we rely on voronoi cells. Besides, to encourage a realistic overlap between the predi
(
num_img=2,
num_gt_per_img=10,
num_pred_per_img=14,
num_classes=2,
height=32,
width=64,
shift=5,
random_pred_label=False,
verbose=True)
| 298 | |
| 299 | |
| 300 | def generate_random_segment_data( |
| 301 | num_img=2, |
| 302 | num_gt_per_img=10, |
| 303 | num_pred_per_img=14, |
| 304 | num_classes=2, |
| 305 | height=32, |
| 306 | width=64, |
| 307 | shift=5, |
| 308 | random_pred_label=False, |
| 309 | verbose=True): |
| 310 | """Generate multiple images with random ground truth and predicted |
| 311 | instance and semantic segmentation data. To make the images |
| 312 | realistic, and to ensure that the instances form a PARTITION of the |
| 313 | image, we rely on voronoi cells. Besides, to encourage a realistic |
| 314 | overlap between the predicted and target instances, the prediction |
| 315 | cell centers are sampled near the target samples. |
| 316 | """ |
| 317 | tm_data = [] |
| 318 | spt_data = [] |
| 319 | |
| 320 | for i_img in range(num_img): |
| 321 | if verbose: |
| 322 | print(f"\nImage {i_img + 1}/{num_img}") |
| 323 | tm_data_, spt_data_ = generate_single_random_segment_image( |
| 324 | num_gt=num_gt_per_img, |
| 325 | num_pred=num_pred_per_img, |
| 326 | num_classes=num_classes, |
| 327 | height=height, |
| 328 | width=width, |
| 329 | shift=shift, |
| 330 | random_pred_label=random_pred_label, |
| 331 | show=verbose) |
| 332 | tm_data.append(tm_data_) |
| 333 | spt_data.append(spt_data_) |
| 334 | |
| 335 | return tm_data, spt_data |
| 336 | |
| 337 | |
| 338 | def _instance_cut_pursuit( |
nothing calls this directly
no test coverage detected