floorplan rec: fix regex rule + filter out extreme values
This commit is contained in:
parent
2e94bda7fa
commit
4dfbcc64c1
1 changed files with 5 additions and 4 deletions
|
|
@ -18,12 +18,13 @@ def inference(image_path):
|
|||
|
||||
|
||||
def extract_total_sqm(input_str: str):
|
||||
sqmregex = r"(\d+\.\d*) ?(sq ?m|sq. ?m)"
|
||||
sqmregex = r"(\d+\.?\d*) ?(sq ?m|sq. ?m)"
|
||||
matches = re.findall(sqmregex, input_str.lower())
|
||||
if len(matches) == 0:
|
||||
return None
|
||||
sqms = [float(m[0]) for m in matches]
|
||||
return max(sqms)
|
||||
filtered = [sqm for sqm in sqms if 30 < sqm < 160]
|
||||
if len(filtered) == 0:
|
||||
return None
|
||||
return max(filtered)
|
||||
|
||||
|
||||
def calculate_model(image_path):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue