* fixing DemoNotebook

* fixing DemoNotebook2

* rearrange the code and text

* continiue changing demo notebook

* continiue changing demo notebook2

* fixing bug on a100 in google colab

* change order of tests and do not test for age in faces

* add screenshots for gcv api

* instructions for google cloud vision API

* link instructions in readme

* add missing image

* trim whitespace

---------

Co-authored-by: Inga Ulusoy <inga.ulusoy@uni-heidelberg.de>
Этот коммит содержится в:
Petr Andriushchenko 2024-02-16 09:05:39 +01:00 коммит произвёл GitHub
родитель fcb2d55740
Коммит bec845e774
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
27 изменённых файлов: 923 добавлений и 67 удалений

Просмотреть файл

@ -119,7 +119,7 @@ Place the data files and google cloud vision API key in your google drive to acc
## Features
### Text extraction
The text is extracted from the images using [google-cloud-vision](https://cloud.google.com/vision). For this, you need an API key. Set up your google account following the instructions on the google Vision AI website.
The text is extracted from the images using [google-cloud-vision](https://cloud.google.com/vision). For this, you need an API key. Set up your google account following the instructions on the google Vision AI website or as described [here](docs/google_Cloud_Vision_API/set_up_credentials.md).
You then need to export the location of the API key as an environment variable:
```
export GOOGLE_APPLICATION_CREDENTIALS="location of your .json"

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -3,7 +3,6 @@
"multiple_faces": "Yes",
"no_faces": 11,
"wears_mask": ["No", "No", "Yes"],
"age": [36, 35, 33],
"gender": ["Man", "Man", "Man"],
"race": ["white", "white", null],
"emotion": ["sad", "fear", null],

Просмотреть файл

@ -42,24 +42,6 @@ def test_AnalysisExplorer(get_AE, get_options):
assert get_AE.update_picture(None) is None
def test_right_output_analysis_emotions(get_AE, get_options):
get_AE._right_output_analysis(
2,
get_options[3],
get_options[0],
"EmotionDetector",
True,
None,
None,
50,
50,
"CIE 1976",
"summary_and_questions",
"base",
"How many people are in the picture?",
)
def test_right_output_analysis_summary(get_AE, get_options):
get_AE._right_output_analysis(
2,
@ -76,3 +58,21 @@ def test_right_output_analysis_summary(get_AE, get_options):
"base",
"How many people are in the picture?",
)
def test_right_output_analysis_emotions(get_AE, get_options):
get_AE._right_output_analysis(
2,
get_options[3],
get_options[0],
"EmotionDetector",
True,
None,
None,
50,
50,
"CIE 1976",
"summary_and_questions",
"base",
"How many people are in the picture?",
)

Просмотреть файл

@ -29,5 +29,7 @@ def test_analyse_faces(get_path):
out_dict = json.load(file)
# delete the filename key
mydict.pop("filename", None)
# delete the age key, as this is conflicting - gives different results sometimes
mydict.pop("age", None)
for key in mydict.keys():
assert mydict[key] == out_dict[key]

Двоичные данные
docs/google_Cloud_Vision_API/img0.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 130 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img1.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 145 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img10.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 134 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img11.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 69 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img12.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 50 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img13.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 48 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img14.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 73 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img15.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 81 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img16.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 42 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img17.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 113 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img18.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 61 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img19.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 56 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img2.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 51 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img3.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 54 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img4.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 124 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img5.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 133 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img6.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 80 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img7.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 107 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img8.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 131 KiB

Двоичные данные
docs/google_Cloud_Vision_API/img9.png Обычный файл

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 80 KiB

Просмотреть файл

@ -0,0 +1,44 @@
# Instructions how to generate and enable a google Cloud Vision API key
1. Go to [google-cloud-vision](https://cloud.google.com/vision) and click on "Console". Sign into your google account / create a new google account if prompted. This will bring you to the following page, where you click on "project" in the top of the screen.
![img0](img0.png)
2. Select "project" from the top left drop-down menu.
![img1](img1.png)
3. Click on "NEW PROJECT" on the left of the pop-up window.
![img2](img2.png)
4. Enter a project name and click on "CREATE".
![img3](img3.png)
5. Now you should be back on the dashboard. In the top right, click on the three vertical dots.
![img4](img4.png)
6. In the drop-down menu, select "Project settings".
![img5](img5.png)
7. In the menu on the left, click on "Service Accounts".
![img6](img6.png)
8. Click on "+ CREATE SERVICE ACCOUNT".
![img7](img7.png)
9. Select a service account ID (you can pick this as any name you wish). Click on "DONE".
![img8](img8.png)
10. Now your service account should show up in the list of service accounts.
![img9](img9.png)
11. Click on the three vertical dots to the right of your service account name and select "Manage keys".
![img10](img10.png)
12. Click on "Create new key".
![img11](img11.png)
13. In the pop-up window, select "JSON" and click "CREATE".
![img12](img12.png)
14. The private key is directly downloaded to your computer. It should be in your downloads folder.
![img13](img13.png)
15. The JSON key file will look something like this (any private information has been blanked out in the screenshot).
![img14](img14.png)
16. Now go back to your browser window. Click on "Google Cloud" in the top left corner.
![img15](img15.png)
17. Now select "APIs & Services".
![img16](img16.png)
18. From the selection of APIs, select "Cloud Vision API" or search for it and then select.
![img17](img17.png)
19. Click on "ENABLE".
![img18](img18.png)
20. Google Cloud Vision API is now enabled for your key.
![img19](img19.png)
21. Place the JSON key in a selected folder on your computer and reference this key in your Jupyter Notebook / Python console when running ammico. Or, upload it to your google Drive to use it on google Colaboratory.

Просмотреть файл

@ -54,6 +54,7 @@ dependencies = [
"webcolors",
"colour-science",
"scikit-learn>1.3.0",
"tqdm"
]
[project.scripts]