- fixed max index
- call status once inside epoch loop
This commit is contained in:
@@ -76,8 +76,6 @@ class Layer:
|
|||||||
|
|
||||||
training_seen += 1
|
training_seen += 1
|
||||||
|
|
||||||
status.on_change({"progress": {"value": round(training_seen*d_progress), "unit": "%"}, "err_rms": {"value": err_rms, "unit": ""}})
|
|
||||||
|
|
||||||
def v_to_ph(self, v: np.ndarray) -> np.ndarray:
|
def v_to_ph(self, v: np.ndarray) -> np.ndarray:
|
||||||
state = self.state.v_to_h(v)
|
state = self.state.v_to_h(v)
|
||||||
if self.params.do_gaussian_visible:
|
if self.params.do_gaussian_visible:
|
||||||
|
|||||||
+6
-6
@@ -25,7 +25,7 @@ class MyStatus(Status):
|
|||||||
shape = self.stack.from_index(0).shape[0:2] + (1,)
|
shape = self.stack.from_index(0).shape[0:2] + (1,)
|
||||||
|
|
||||||
# User input
|
# User input
|
||||||
max_index = self.batch.shape[0]
|
max_index = self.batch.shape[0] - 1
|
||||||
key = cv.waitKeyEx(1)
|
key = cv.waitKeyEx(1)
|
||||||
if key == ord('q'):
|
if key == ord('q'):
|
||||||
do_continue = False
|
do_continue = False
|
||||||
@@ -74,20 +74,20 @@ def main(prj_name: str = "test"):
|
|||||||
stack.state_load()
|
stack.state_load()
|
||||||
|
|
||||||
# Load train data
|
# Load train data
|
||||||
training_data_path = os.path.join(prj_root, f"{prj_name}.training.dat")
|
training_data = read_armadillo(os.path.join(prj_root, f"{prj_name}.training.dat"))
|
||||||
batch = read_armadillo(training_data_path)
|
test_data = read_armadillo(os.path.join(prj_root, f"{prj_name}.test.dat"))
|
||||||
|
|
||||||
# Prepare status listener
|
# Prepare status listener
|
||||||
my_status = MyStatus(stack, batch)
|
my_status = MyStatus(stack, test_data)
|
||||||
|
|
||||||
# Train
|
# Train
|
||||||
stack.train(batch, status=my_status)
|
stack.train(training_data, status=my_status)
|
||||||
|
|
||||||
# Save state
|
# Save state
|
||||||
stack.state_save()
|
stack.state_save()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main("norb_small_16h")
|
main("norb_small_16h_v2")
|
||||||
cv.destroyAllWindows()
|
cv.destroyAllWindows()
|
||||||
|
|
||||||
print("Test: [passed]")
|
print("Test: [passed]")
|
||||||
|
|||||||
Reference in New Issue
Block a user