migrated to poetry, dataclasses

This commit is contained in:
andy 2021-01-29 22:05:37 +00:00
parent c7292cc00a
commit 3829f09e21
7 changed files with 1426 additions and 93 deletions

2
gui.py
View File

@ -1,6 +1,6 @@
import cv2
img = cv2.imread('nebula2.jpg', 0)
img = cv2.imread('sheep.png')
cv2.imshow('image', img)
k = cv2.waitKey(0)

1388
poetry.lock generated Normal file

File diff suppressed because it is too large Load Diff

23
pyproject.toml Normal file
View File

@ -0,0 +1,23 @@
[tool.poetry]
name = "vision"
version = "0.1.0"
description = "Jupyter scratchpad for playing with computer vision"
authors = ["andy <andy@sarsoo.xyz>"]
[tool.poetry.dependencies]
python = "^3.8"
numpy = "^1.19.5"
opencv-python = "^4.5.1"
scikit-learn = "^0.24.1"
scipy = "^1.6.0"
jupyterlab = {version = "^3.0.6", optional = true}
ipykernel = "^5.4.3"
[tool.poetry.dev-dependencies]
[tool.poetry.extras]
jupyter = ["jupyterlab"]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

View File

@ -1,78 +0,0 @@
anyio==2.0.2
argon2-cffi==20.1.0
async-generator==1.10
attrs==20.3.0
Babel==2.9.0
backcall==0.2.0
bleach==3.2.1
certifi==2020.12.5
cffi==1.14.4
chardet==4.0.0
colorama==0.4.4
cycler==0.10.0
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
idna==2.10
importlib-metadata==3.3.0
ipykernel==5.4.2
ipython==7.19.0
ipython-genutils==0.2.0
jedi==0.18.0
Jinja2==2.11.2
joblib==1.0.0
json5==0.9.5
jsonschema==3.2.0
jupyter-client==6.1.7
jupyter-core==4.7.0
jupyter-server==1.1.3
jupyterlab==3.0.0
jupyterlab-pygments==0.1.2
jupyterlab-server==2.0.0
kiwisolver==1.3.1
MarkupSafe==1.1.1
matplotlib==3.3.3
mistune==0.8.4
more-itertools==8.6.0
nbclassic==0.2.5
nbclient==0.5.1
nbconvert==6.0.7
nbformat==5.0.8
nest-asyncio==1.4.3
notebook==6.1.6
numpy==1.19.4
opencv-python==4.4.0.46
packaging==20.8
pandas==1.2.0
pandocfilters==1.4.3
parso==0.8.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.0.1
prometheus-client==0.9.0
prompt-toolkit==3.0.8
ptyprocess==0.7.0
pycparser==2.20
Pygments==2.7.3
pyparsing==2.4.7
pyrsistent==0.17.3
python-dateutil==2.8.1
pytz==2020.5
pywin32==300
pywinpty==0.5.7
pyzmq==20.0.0
requests==2.25.1
scikit-learn==0.24.0
scipy==1.6.0
Send2Trash==1.5.0
six==1.15.0
sniffio==1.2.0
terminado==0.9.1
testpath==0.4.4
threadpoolctl==2.1.0
tornado==6.1
traitlets==5.0.5
urllib3==1.26.2
wcwidth==0.2.5
webencodings==0.5.1
zipp==3.4.0

View File

@ -1,12 +1,13 @@
from dataclasses import dataclass
from typing import List
from vision.model import Image
@dataclass
class PrecisionRecall:
def __init__(self, precision, recall, ap):
self.precision = precision
self.recall = recall
self.ap = ap
precision: float
recall: float
ap: float
def get_precision(images: List[Image], test):

View File

@ -1,3 +1,4 @@
from dataclasses import dataclass
from vision.model import Image
from typing import List
import numpy as np
@ -6,10 +7,10 @@ import math as m
import cv2
@dataclass
class Edge:
def __init__(self, magnitude: np.array, angle: np.array):
self.magnitude = magnitude
self.angle = angle
magnitude: np.array
angle: np.array
def get_edge_angle_hist(edge: Edge, bins: int, threshold: float):

View File

@ -1,3 +1,4 @@
from dataclasses import dataclass
from typing import List
import random
import numpy as np
@ -8,14 +9,11 @@ import logging
logger = logging.getLogger(__name__)
@dataclass
class QueryResult:
def __init__(self,
sorted_images: List[Image],
query_image: Image,
precision_recall: pr.PrecisionRecall):
self.sorted_images = sorted_images
self.query_image = query_image
self.precision_recall = precision_recall
sorted_images: List[Image]
query_image: Image
precision_recall: pr.PrecisionRecall
def run_query(images: List[Image], distance_measure=None, query_index=None):