)
token_background = 0
-first_fish_token = 1
-nb_fish_tokens = len(colors) - 1
-token_forward = first_fish_token + nb_fish_tokens
+first_bird_token = 1
+nb_bird_tokens = len(colors) - 1
+token_forward = first_bird_token + nb_bird_tokens
token_backward = token_forward + 1
token2char = "_" + "".join([str(n) for n in range(len(colors) - 1)]) + "><"
f_end = torch.zeros(height, width, dtype=torch.int64)
n = torch.arange(f_start.size(0))
- nb_fish = torch.randint(max_nb_obj, (1,)).item() + 1
+ nb_birds = torch.randint(max_nb_obj, (1,)).item() + 1
for c in (
- (torch.randperm(nb_fish_tokens) + first_fish_token)[:nb_fish].sort().values
+ (torch.randperm(nb_bird_tokens) + first_bird_token)[:nb_birds].sort().values
):
i, j = (
torch.randint(height - 2, (1,))[0] + 1,
def mosaic(x, upscale):
x = x.reshape(-1, height, width)
- m = torch.logical_and(x >= 0, x < first_fish_token + nb_fish_tokens).long()
+ m = torch.logical_and(x >= 0, x < first_bird_token + nb_bird_tokens).long()
x = colors[x * m].permute(0, 3, 1, 2)
s = x.shape
x = x[:, :, :, None, :, None].expand(-1, -1, -1, upscale, -1, upscale)
print(seq2str(seq[:4]))
- m = (torch.rand(seq.size()) < 0.05).long()
- seq = (1 - m) * seq + m * 23
+ # m = (torch.rand(seq.size()) < 0.05).long()
+ # seq = (1 - m) * seq + m * 23
img = sample2img(seq, height, width)
print(img.size())