Commit 81a8352c authored by lucas_miranda's avatar lucas_miranda
Browse files

Added testing examples for multi animal deepof pipeline

parent efd4e22e
Pipeline #91179 canceled with stage
in 11 minutes and 46 seconds
......@@ -33,7 +33,7 @@ def test_project_init(table_type, arena_type):
if arena_type == "foo":
with pytest.raises(NotImplementedError):
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena=arena_type,
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -41,7 +41,7 @@ def test_project_init(table_type, arena_type):
)
else:
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena=arena_type,
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -63,7 +63,7 @@ def test_project_init(table_type, arena_type):
def test_project_properties():
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -98,7 +98,7 @@ def test_get_distances(nodes, ego):
ego = [False, "Center", "Nose"][ego]
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -122,7 +122,7 @@ def test_get_angles(nodes, ego):
ego = [False, "Center", "Nose"][ego]
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -147,7 +147,7 @@ def test_run(nodes, ego):
ego = [False, "Center", "Nose"][ego]
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -164,7 +164,7 @@ def test_run(nodes, ego):
def test_get_rule_based_annotation():
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -190,7 +190,7 @@ def test_get_table_dicts(nodes, ego, exclude, sampler):
ego = [False, "Center", "Nose"][ego]
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......
......@@ -85,7 +85,7 @@ def test_one_cycle_scheduler():
)
fit = test_model.fit(X, y, callbacks=[onecycle], epochs=10, batch_size=100)
assert type(fit) == tf.python.keras.callbacks.History
assert type(fit) == tf.keras.callbacks.History
assert onecycle.history["lr"][4] > onecycle.history["lr"][1]
assert onecycle.history["lr"][4] > onecycle.history["lr"][-1]
......@@ -115,7 +115,7 @@ def test_uncorrelated_features_constraint():
)
fit = test_model.fit(X, y, epochs=10, batch_size=100)
assert type(fit) == tf.python.keras.callbacks.History
assert type(fit) == tf.keras.callbacks.History
correlations.append(np.mean(np.corrcoef(test_model.get_weights()[0])))
......@@ -137,7 +137,7 @@ def test_MCDropout():
)
fit = test_model.fit(X, y, epochs=10, batch_size=100)
assert type(fit) == tf.python.keras.callbacks.History
assert type(fit) == tf.keras.callbacks.History
# noinspection PyUnresolvedReferences
......@@ -158,7 +158,7 @@ def test_dense_transpose():
)
fit = test_model.fit(X, y, epochs=10, batch_size=100)
assert type(fit) == tf.python.keras.callbacks.History
assert type(fit) == tf.keras.callbacks.History
# noinspection PyCallingNonCallable,PyUnresolvedReferences
......@@ -203,7 +203,7 @@ def test_KLDivergenceLayer():
)
fit = test_model.fit(X, [y, y], epochs=1, batch_size=100)
assert tf.python.keras.callbacks.History == type(fit)
assert tf.keras.callbacks.History == type(fit)
assert test_model.losses[0] == test_model.losses[1]
......@@ -245,7 +245,7 @@ def test_MMDiscrepancyLayer():
)
fit = test_model.fit(X, y, epochs=10, batch_size=100)
assert tf.python.keras.callbacks.History == type(fit)
assert tf.keras.callbacks.History == type(fit)
# noinspection PyUnresolvedReferences
......@@ -263,7 +263,7 @@ def test_dead_neuron_control():
)
fit = test_model.fit(X, y, epochs=10, batch_size=100)
assert tf.python.keras.callbacks.History == type(fit)
assert tf.keras.callbacks.History == type(fit)
# noinspection PyUnresolvedReferences
......@@ -281,7 +281,7 @@ def test_entropy_regulariser():
)
fit = test_model.fit(X, y, epochs=10, batch_size=100)
assert type(fit) == tf.python.keras.callbacks.History
assert type(fit) == tf.keras.callbacks.History
def test_find_learning_rate():
......
......@@ -93,7 +93,7 @@ def test_climb_wall(arena, tol):
prun = (
deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([arena[2]]),
video_format=".mp4",
......@@ -360,7 +360,7 @@ def test_frame_corners(w, h):
def test_rule_based_tagging():
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -376,7 +376,9 @@ def test_rule_based_tagging():
prun.get_coords(speed=1),
arena_type="circular",
vid_index=0,
path=os.path.join(".", "tests", "test_examples", "Videos"),
path=os.path.join(
".", "tests", "test_examples", "test_single_topview", "Videos"
),
)
assert type(hardcoded_tags) == pd.DataFrame
......@@ -386,7 +388,7 @@ def test_rule_based_tagging():
def test_rule_based_video():
prun = deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -402,7 +404,9 @@ def test_rule_based_video():
prun.get_coords(speed=1),
arena_type="circular",
vid_index=0,
path=os.path.join(".", "tests", "test_examples", "Videos"),
path=os.path.join(
".", "tests", "test_examples", "test_single_topview", "Videos"
),
)
rule_based_video(
......@@ -412,5 +416,7 @@ def test_rule_based_video():
vid_index=0,
frame_limit=100,
tag_dict=hardcoded_tags,
path=os.path.join(".", "tests", "test_examples", "Videos"),
path=os.path.join(
".", "tests", "test_examples", "test_single_topview", "Videos"
),
)
......@@ -23,7 +23,13 @@ def test_load_hparams():
assert (
type(
deepof.train_utils.load_hparams(
os.path.join("tests", "test_examples", "Others", "test_hparams.pkl")
os.path.join(
"tests",
"test_examples",
"test_single_topview",
"Others",
"test_hparams.pkl",
)
)
)
== dict
......@@ -35,7 +41,7 @@ def test_load_treatments():
assert (
type(
deepof.train_utils.load_treatments(
os.path.join("tests", "test_examples", "Others")
os.path.join("tests", "test_examples", "test_single_topview", "Others")
)
)
== dict
......@@ -70,7 +76,7 @@ def test_get_callbacks(
)
assert type(runID) == str
assert type(tbc) == tf.keras.callbacks.TensorBoard
assert type(cpc) == tf.python.keras.callbacks.ModelCheckpoint
assert type(cpc) == tf.keras.callbacks.ModelCheckpoint
assert type(cycle1c) == deepof.model_utils.one_cycle_scheduler
......
......@@ -354,7 +354,7 @@ def test_smooth_mult_trajectory(alpha, series):
@given(indexes=st.data())
def test_recognize_arena_and_subfunctions(indexes):
path = os.path.join(".", "tests", "test_examples", "Videos")
path = os.path.join(".", "tests", "test_examples", "test_single_topview", "Videos")
videos = [i for i in os.listdir(path) if i.endswith("mp4")]
vid_index = indexes.draw(st.integers(min_value=0, max_value=len(videos) - 1))
......
......@@ -22,7 +22,7 @@ import matplotlib.figure
def test_plot_heatmap(bparts):
prun = (
deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......@@ -49,7 +49,7 @@ def test_plot_heatmap(bparts):
def test_model_comparison_plot():
prun = (
deepof.data.project(
path=os.path.join(".", "tests", "test_examples"),
path=os.path.join(".", "tests", "test_examples", "test_single_topview"),
arena="circular",
arena_dims=tuple([380]),
video_format=".mp4",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment