mirror of
https://github.com/sbrl/research-rainfallradar
synced 2024-11-22 01:12:59 +00:00
ai: predict oops
This commit is contained in:
parent
fa3165a5b2
commit
a96cefde62
2 changed files with 10 additions and 16 deletions
|
@ -88,18 +88,15 @@ class RainfallWaterContraster(object):
|
|||
i_batch = -1
|
||||
for batch in dataset:
|
||||
i_batch += 1
|
||||
result_batch = self.model_predict(batch[0]) # ((rainfall, water), dummy_label)
|
||||
rainfall, water = tf.unstack(result_batch, axis=-2)
|
||||
rainfall = self.model_predict(batch) # ((rainfall, water), dummy_label)
|
||||
|
||||
rainfall = tf.unstack(rainfall, axis=0)
|
||||
water = tf.unstack(water, axis=0)
|
||||
for step in zip(rainfall, water):
|
||||
for step in tf.unstack(rainfall, axis=0):
|
||||
yield step
|
||||
|
||||
|
||||
def embed_rainfall(self, dataset):
|
||||
result = []
|
||||
for batch in dataset:
|
||||
result_batch = self.model_predict(batch)
|
||||
result.extend(tf.unstack(result_batch, axis=0))
|
||||
return result
|
||||
# def embed_rainfall(self, dataset):
|
||||
# result = []
|
||||
# for batch in dataset:
|
||||
# result_batch = self.model_predict(batch)
|
||||
# result.extend(tf.unstack(result_batch, axis=0))
|
||||
# return result
|
|
@ -68,11 +68,8 @@ def run(args):
|
|||
handle = handle_open(filepath_output, "w")
|
||||
|
||||
i = 0
|
||||
for rainfall, water in ai.embed(dataset):
|
||||
handle.write(json.dumps({
|
||||
"rainfall": rainfall.numpy().tolist(),
|
||||
"water": water.numpy().tolist()
|
||||
}, separators=(',', ':'))+"\n") # Ref https://stackoverflow.com/a/64710892/1460422
|
||||
for rainfall in ai.embed(dataset):
|
||||
handle.write(json.dumps(rainfall.numpy().tolist(), separators=(',', ':'))+"\n") # Ref https://stackoverflow.com/a/64710892/1460422
|
||||
|
||||
if i == 0 or i % 1000 == 0:
|
||||
sys.stderr.write(f"[pretrain:predict] STEP {i}\r")
|
||||
|
|
Loading…
Reference in a new issue