Compare commits

..

No commits in common. "b72cd1b9170fe625ae4a15fcefb8a4d301bdb5e9" and "8af279771a0905ce1ce03b7efa4b877eeb7e4739" have entirely different histories.

2 changed files with 8 additions and 15 deletions

21
eval.py
View File

@ -66,7 +66,6 @@ def load_model(model_path, device):
config = json.load(f) config = json.load(f)
trained_encoder = SentenceTransformer(model_path, device=str(device)) trained_encoder = SentenceTransformer(model_path, device=str(device))
trained_encoder.to(device)
trained_head = load_head( trained_head = load_head(
model_path, "coordinate_head.pt", trained_encoder, config, device model_path, "coordinate_head.pt", trained_encoder, config, device
) )
@ -77,7 +76,6 @@ def load_model(model_path, device):
base_encoder = SentenceTransformer(initial_encoder_path, device=str(device)) base_encoder = SentenceTransformer(initial_encoder_path, device=str(device))
else: else:
base_encoder = SentenceTransformer(config["model_name"], device=str(device)) base_encoder = SentenceTransformer(config["model_name"], device=str(device))
base_encoder.to(device)
initial_head_path = os.path.join(model_path, "initial_coordinate_head.pt") initial_head_path = os.path.join(model_path, "initial_coordinate_head.pt")
initial_head = None initial_head = None
if os.path.exists(initial_head_path): if os.path.exists(initial_head_path):
@ -122,18 +120,8 @@ def make_prediction_plot(results, plot_file):
color="0.75", color="0.75",
linewidth=0.4, linewidth=0.4,
alpha=0.35, alpha=0.35,
zorder=1,
) )
ax.scatter(
results["predicted_longitude"],
results["predicted_latitude"],
s=12,
color="#d62728",
alpha=0.45,
label="predicted",
zorder=2,
)
ax.scatter( ax.scatter(
results["longitude"], results["longitude"],
results["latitude"], results["latitude"],
@ -141,7 +129,14 @@ def make_prediction_plot(results, plot_file):
color="#1f77b4", color="#1f77b4",
alpha=0.75, alpha=0.75,
label="actual", label="actual",
zorder=3, )
ax.scatter(
results["predicted_longitude"],
results["predicted_latitude"],
s=12,
color="#d62728",
alpha=0.45,
label="predicted",
) )
ax.set_xlabel("longitude") ax.set_xlabel("longitude")
ax.set_ylabel("latitude") ax.set_ylabel("latitude")

View File

@ -3,7 +3,6 @@ import argparse
import pandas as pd import pandas as pd
INPUT_COLUMNS = ["intersection", "text_on_sign_exact", "latitude", "longitude"] INPUT_COLUMNS = ["intersection", "text_on_sign_exact", "latitude", "longitude"]
EXCLUDED_INTERSECTIONS = {"56th-pena"}
def parse_args(): def parse_args():
@ -58,7 +57,6 @@ def load_raw_data(path):
data = data.dropna(subset=INPUT_COLUMNS) data = data.dropna(subset=INPUT_COLUMNS)
data["text_on_sign_exact"] = data["text_on_sign_exact"].astype(str).str.strip() data["text_on_sign_exact"] = data["text_on_sign_exact"].astype(str).str.strip()
data = data[data["text_on_sign_exact"] != ""] data = data[data["text_on_sign_exact"] != ""]
data = data[~data["intersection"].isin(EXCLUDED_INTERSECTIONS)]
return data return data