|
@@ -81,17 +81,17 @@ class DataProcessor(object):
|
|
|
print(video_id, "\t", e)
|
|
|
return []
|
|
|
|
|
|
- def producer(self):
|
|
|
+ def producer(self, dt):
|
|
|
"""
|
|
|
生成数据
|
|
|
:return:none
|
|
|
"""
|
|
|
if self.flag == "train":
|
|
|
- x_path = "data/hour_train.json"
|
|
|
- y_path = "data/daily-label-20240101-20240320.json"
|
|
|
+ x_path = "data/train_data/train_2024010100_2024031523.json"
|
|
|
+ y_path = "data/train_data/daily-label-20240101-20240325.json"
|
|
|
elif self.flag == "predict":
|
|
|
- x_path = "prid_data/train_0319.json"
|
|
|
- y_path = "data/daily-label-20240315-20240321.json"
|
|
|
+ x_path = "data/pred_data/pred_202403{}00_202403{}23.json".format(dt, dt)
|
|
|
+ y_path = "data/train_data/daily-label-20240101-20240325.json"
|
|
|
else:
|
|
|
return
|
|
|
with open(x_path) as f:
|
|
@@ -106,13 +106,18 @@ class DataProcessor(object):
|
|
|
our_label, features = self.generate_train_label(video_obj, y_data, c)
|
|
|
x_list.append(features)
|
|
|
y_list.append(our_label)
|
|
|
- with open("produce_data/x_data_{}_{}.json".format(c, self.flag), "w") as f1:
|
|
|
+ with open("data/produce_data/x_data_{}_{}_{}.json".format(c, self.flag, dt), "w") as f1:
|
|
|
f1.write(json.dumps(x_list, ensure_ascii=False))
|
|
|
|
|
|
- with open("produce_data/y_data_{}_{}.json".format(c, self.flag), "w") as f2:
|
|
|
+ with open("data/produce_data/y_data_{}_{}_{}.json".format(c, self.flag, dt), "w") as f2:
|
|
|
f2.write(json.dumps(y_list, ensure_ascii=False))
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- D = DataProcessor(flag="predict")
|
|
|
- D.producer()
|
|
|
+ flag = str(input("please input method train or predict"))
|
|
|
+ D = DataProcessor(flag=flag)
|
|
|
+ if flag == "predict":
|
|
|
+ for d in range(16, 22):
|
|
|
+ D.producer(d)
|
|
|
+ else:
|
|
|
+ D.producer(dt="whole")
|