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