Minor fixing (#172)
* 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>
@ -119,7 +119,7 @@ Place the data files and google cloud vision API key in your google drive to acc
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
### Text extraction
|
### 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:
|
You then need to export the location of the API key as an environment variable:
|
||||||
```
|
```
|
||||||
export GOOGLE_APPLICATION_CREDENTIALS="location of your .json"
|
export GOOGLE_APPLICATION_CREDENTIALS="location of your .json"
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
"multiple_faces": "Yes",
|
"multiple_faces": "Yes",
|
||||||
"no_faces": 11,
|
"no_faces": 11,
|
||||||
"wears_mask": ["No", "No", "Yes"],
|
"wears_mask": ["No", "No", "Yes"],
|
||||||
"age": [36, 35, 33],
|
|
||||||
"gender": ["Man", "Man", "Man"],
|
"gender": ["Man", "Man", "Man"],
|
||||||
"race": ["white", "white", null],
|
"race": ["white", "white", null],
|
||||||
"emotion": ["sad", "fear", null],
|
"emotion": ["sad", "fear", null],
|
||||||
|
|||||||
@ -42,24 +42,6 @@ def test_AnalysisExplorer(get_AE, get_options):
|
|||||||
assert get_AE.update_picture(None) is None
|
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):
|
def test_right_output_analysis_summary(get_AE, get_options):
|
||||||
get_AE._right_output_analysis(
|
get_AE._right_output_analysis(
|
||||||
2,
|
2,
|
||||||
@ -76,3 +58,21 @@ def test_right_output_analysis_summary(get_AE, get_options):
|
|||||||
"base",
|
"base",
|
||||||
"How many people are in the picture?",
|
"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)
|
out_dict = json.load(file)
|
||||||
# delete the filename key
|
# delete the filename key
|
||||||
mydict.pop("filename", None)
|
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():
|
for key in mydict.keys():
|
||||||
assert mydict[key] == out_dict[key]
|
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 |
44
docs/google_Cloud_Vision_API/set_up_credentials.md
Обычный файл
@ -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.
|
||||||
|

|
||||||
|
2. Select "project" from the top left drop-down menu.
|
||||||
|

|
||||||
|
3. Click on "NEW PROJECT" on the left of the pop-up window.
|
||||||
|

|
||||||
|
4. Enter a project name and click on "CREATE".
|
||||||
|

|
||||||
|
5. Now you should be back on the dashboard. In the top right, click on the three vertical dots.
|
||||||
|

|
||||||
|
6. In the drop-down menu, select "Project settings".
|
||||||
|

|
||||||
|
7. In the menu on the left, click on "Service Accounts".
|
||||||
|

|
||||||
|
8. Click on "+ CREATE SERVICE ACCOUNT".
|
||||||
|

|
||||||
|
9. Select a service account ID (you can pick this as any name you wish). Click on "DONE".
|
||||||
|

|
||||||
|
10. Now your service account should show up in the list of service accounts.
|
||||||
|

|
||||||
|
11. Click on the three vertical dots to the right of your service account name and select "Manage keys".
|
||||||
|

|
||||||
|
12. Click on "Create new key".
|
||||||
|

|
||||||
|
13. In the pop-up window, select "JSON" and click "CREATE".
|
||||||
|

|
||||||
|
14. The private key is directly downloaded to your computer. It should be in your downloads folder.
|
||||||
|

|
||||||
|
15. The JSON key file will look something like this (any private information has been blanked out in the screenshot).
|
||||||
|

|
||||||
|
16. Now go back to your browser window. Click on "Google Cloud" in the top left corner.
|
||||||
|

|
||||||
|
17. Now select "APIs & Services".
|
||||||
|

|
||||||
|
18. From the selection of APIs, select "Cloud Vision API" or search for it and then select.
|
||||||
|

|
||||||
|
19. Click on "ENABLE".
|
||||||
|

|
||||||
|
20. Google Cloud Vision API is now enabled for your key.
|
||||||
|

|
||||||
|
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",
|
"webcolors",
|
||||||
"colour-science",
|
"colour-science",
|
||||||
"scikit-learn>1.3.0",
|
"scikit-learn>1.3.0",
|
||||||
|
"tqdm"
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
|
|||||||