MCPcopy Create free account
hub / github.com/InternRobotics/G2VLM / split_integer_exp_decay

Function split_integer_exp_decay

data/data_utils.py:242–251  ·  view source on GitHub ↗
(S, ng_sample_decay=1.0)

Source from the content-addressed store, hash-verified

240
241
242def split_integer_exp_decay(S, ng_sample_decay=1.0):
243 if ng_sample_decay == 1.0:
244 N = random.randint(1, S)
245 else:
246 base = (1 - ng_sample_decay) / (1 - math.pow(ng_sample_decay, S))
247 p = [base * math.pow(ng_sample_decay, i) for i in range(S)]
248 N = random.choices(list(range(1, S + 1)), p, k=1)[0]
249 cumsum = [0] + sorted(random.sample(range(1, S), N - 1)) + [S]
250 result = [cumsum[i+1] - cumsum[i] for i in range(len(cumsum) - 1)]
251 return result, cumsum
252
253
254def pil_img2rgb(image):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected