зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 13:06:04 +02:00
Merge branch 'main' into add_itm
Этот коммит содержится в:
Коммит
5441edf2d6
@ -2,21 +2,17 @@ repos:
|
||||
- repo: https://github.com/kynan/nbstripout
|
||||
rev: 0.6.1
|
||||
hooks:
|
||||
- id: nbstripout
|
||||
files: ".ipynb"
|
||||
- id: nbstripout
|
||||
files: ".ipynb"
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.12.0
|
||||
rev: 23.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.12.0
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: black-jupyter
|
||||
- repo: https://github.com/pycqa/flake8
|
||||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/s-weigand/flake8-nb
|
||||
rev: v0.5.0
|
||||
hooks:
|
||||
- id: flake8-nb
|
||||
- id: flake8
|
||||
- repo: https://github.com/s-weigand/flake8-nb
|
||||
rev: v0.5.0
|
||||
hooks:
|
||||
- id: flake8-nb
|
||||
|
||||
@ -153,7 +153,6 @@ class EmotionDetector(utils.AnalysisMethod):
|
||||
return fresult
|
||||
|
||||
def facial_expression_analysis(self) -> dict:
|
||||
|
||||
# Find (multiple) faces in the image and cut them
|
||||
retinaface_model.get()
|
||||
faces = RetinaFace.extract_faces(self.subdict["filename"])
|
||||
|
||||
@ -154,6 +154,7 @@ class MultimodalSearch(AnalysisMethod):
|
||||
|
||||
return features_text
|
||||
|
||||
|
||||
def parsing_images(
|
||||
self,
|
||||
model_type,
|
||||
@ -161,6 +162,9 @@ class MultimodalSearch(AnalysisMethod):
|
||||
path_to_load_tensors=None,
|
||||
):
|
||||
|
||||
|
||||
|
||||
|
||||
if model_type in ("clip_base", "clip_vitl14_336", "clip_vitl14"):
|
||||
path_to_lib = lavis.__file__[:-11] + "models/clip_models/"
|
||||
url = "https://raw.githubusercontent.com/salesforce/LAVIS/main/lavis/models/clip_models/bpe_simple_vocab_16e6.txt.gz"
|
||||
@ -189,7 +193,11 @@ class MultimodalSearch(AnalysisMethod):
|
||||
}
|
||||
|
||||
if model_type in select_model.keys():
|
||||
(model, vis_processors, txt_processors,) = select_model[
|
||||
(
|
||||
model,
|
||||
vis_processors,
|
||||
txt_processors,
|
||||
) = select_model[
|
||||
model_type
|
||||
](self, MultimodalSearch.multimodal_device)
|
||||
else:
|
||||
@ -225,7 +233,6 @@ class MultimodalSearch(AnalysisMethod):
|
||||
def querys_processing(
|
||||
self, search_query, model, txt_processors, vis_processors, model_type
|
||||
):
|
||||
|
||||
select_extract_image_features = {
|
||||
"blip2": MultimodalSearch.extract_image_features_blip2,
|
||||
"blip": MultimodalSearch.extract_image_features_basic,
|
||||
|
||||
@ -37,7 +37,6 @@ class SummaryDetector(AnalysisMethod):
|
||||
return summary_model, summary_vis_processors
|
||||
|
||||
def analyse_image(self, summary_model=None, summary_vis_processors=None):
|
||||
|
||||
if summary_model is None and summary_vis_processors is None:
|
||||
summary_model, summary_vis_processors = self.load_model_base()
|
||||
|
||||
|
||||
4
notebooks/colors_expression.ipynb
сгенерированный
4
notebooks/colors_expression.ipynb
сгенерированный
@ -48,7 +48,7 @@
|
||||
" startX = 0\n",
|
||||
" # loop over the percentage of each cluster and the color of\n",
|
||||
" # each cluster\n",
|
||||
" for (percent, color) in zip(hist, centroids):\n",
|
||||
" for percent, color in zip(hist, centroids):\n",
|
||||
" # plot the relative percentage of each cluster\n",
|
||||
" endX = startX + (percent * 300)\n",
|
||||
" cv2.rectangle(\n",
|
||||
@ -123,7 +123,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"for (percent, color) in zip(hist, clt.cluster_centers_):\n",
|
||||
"for percent, color in zip(hist, clt.cluster_centers_):\n",
|
||||
" print(\"color:\", color, \" percentage:\", percent)"
|
||||
]
|
||||
}
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user