(args, batch_data, control_type, device, model=None,batch_size=None, train=True, seg_model=None)
| 22 | model.load_state_dict(state_dict, strict=strict) |
| 23 | del state_dict |
| 24 | def get_cond_control(args, batch_data, control_type, device, model=None,batch_size=None, train=True, seg_model=None): |
| 25 | # Single-control |
| 26 | control_type = copy.deepcopy(control_type)[0] |
| 27 | if control_type == "GAN_Generated" : |
| 28 | if train: |
| 29 | #assert "pose_map" in batch_data |
| 30 | c_cat = batch_data["condition"].cuda() |
| 31 | cond_image = batch_data["condition_image"].cuda() |
| 32 | #import pdb;pdb.set_trace() |
| 33 | |
| 34 | cond_image = model.get_first_stage_encoding(model.encode_first_stage(cond_image)) |
| 35 | cond_img_cat = cond_image |
| 36 | else: |
| 37 | #assert "pose_map_list" in batch_data |
| 38 | pose_map_list = batch_data["condition"] |
| 39 | #print("Get Inference Control Type") |
| 40 | c_cat_list = pose_map_list |
| 41 | cond_image = batch_data["condition_image"].cuda() |
| 42 | cond_image = model.get_first_stage_encoding(model.encode_first_stage(cond_image)) |
| 43 | cond_img_cat = cond_image.cuda() |
| 44 | else: |
| 45 | raise NotImplementedError(f"cond_type={control_type} not supported!") |
| 46 | if train: |
| 47 | return [ c_cat[:batch_size].to(device) ], [cond_img_cat[:batch_size].to(device) ] |
| 48 | else: |
| 49 | return pose_map_list, [cond_img_cat] |
| 50 | |
| 51 | def visualize(args, name, batch_data, infer_model, case, nSample): |
| 52 | infer_model.eval() |
nothing calls this directly
no test coverage detected