зеркало из
https://github.com/ssciwr/AMMICO.git
synced 2025-10-29 13:06:04 +02:00
Update notebooks for colab (#76)
* use pip with ipython magic and not terminal * loosen setuptools version for colab notebooks * update install instructions
Этот коммит содержится в:
родитель
530c8525a8
Коммит
90d049fdf7
@ -34,9 +34,9 @@ Use pre-processed image files such as social media posts with comments and proce
|
||||
|
||||
## Installation
|
||||
|
||||
The `AMMICO` package can be installed using pip: Navigate into your package folder `ammico/` and execute
|
||||
The `AMMICO` package can be installed using pip:
|
||||
```
|
||||
pip install .
|
||||
pip install git+https://github.com/ssciwr/ammico.git
|
||||
```
|
||||
This will install the package and its dependencies locally.
|
||||
|
||||
|
||||
19
notebooks/cropposts.ipynb
сгенерированный
19
notebooks/cropposts.ipynb
сгенерированный
@ -39,11 +39,11 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# load ref view for cropping the same type social media posts images.\n",
|
||||
"ref_view = np.array(Image.open(\"data/ref/ref-00.png\"))\n",
|
||||
"ref_view = np.array(Image.open(\"../data/ref/ref-00.png\"))\n",
|
||||
"plt.imshow(ref_view)\n",
|
||||
"plt.show()\n",
|
||||
"\n",
|
||||
"view = np.array(Image.open(\"data/napsa/100539_ben.png\"))\n",
|
||||
"view = np.array(Image.open(\"../data/all/102790S_eng.png\"))\n",
|
||||
"plt.figure(figsize=(10, 15))\n",
|
||||
"plt.imshow(view)\n",
|
||||
"plt.show()"
|
||||
@ -62,7 +62,8 @@
|
||||
")\n",
|
||||
"\n",
|
||||
"# save cropped images\n",
|
||||
"cv2.imwrite(\"data/100539_ben.png\", crop_view)"
|
||||
"cv2.imwrite(\"test.png\", crop_view)\n",
|
||||
"print(match_num)"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -72,7 +73,7 @@
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"view2 = np.array(Image.open(\"data/napsa/100541_ben.png\"))\n",
|
||||
"view2 = np.array(Image.open(\"../data/all/102790S_eng.png\"))\n",
|
||||
"plt.figure(figsize=(10, 15))\n",
|
||||
"plt.imshow(view2)\n",
|
||||
"plt.show()"
|
||||
@ -101,9 +102,9 @@
|
||||
"# Batch crop images from image folders.\n",
|
||||
"# The cropped images will save in save_crop_dir folders with the same file name form origin.\n",
|
||||
"# We can set many types reference images in ref_dir folder, to crop posts images in different types social media, like twitter or facebook.\n",
|
||||
"ref_dir = \"./data/ref\"\n",
|
||||
"crop_dir = \"./data/apsa\"\n",
|
||||
"save_crop_dir = \"data/crop\"\n",
|
||||
"ref_dir = \"../data/ref\"\n",
|
||||
"crop_dir = \"../data/all\"\n",
|
||||
"save_crop_dir = \"../data/crop\"\n",
|
||||
"crpo.crop_posts_from_files(\n",
|
||||
" ref_dir, crop_dir, save_crop_dir, plt_match=False, plt_crop=False\n",
|
||||
")\n",
|
||||
@ -122,7 +123,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
@ -136,7 +137,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.3"
|
||||
"version": "3.9.16"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
4
notebooks/facial_expressions.ipynb
сгенерированный
4
notebooks/facial_expressions.ipynb
сгенерированный
@ -34,9 +34,9 @@
|
||||
"if \"google.colab\" in str(get_ipython()):\n",
|
||||
" # update python version\n",
|
||||
" # install setuptools\n",
|
||||
" !pip install setuptools==61 -qqq\n",
|
||||
" # %pip install setuptools==61 -qqq\n",
|
||||
" # install ammico\n",
|
||||
" !pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" %pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" # mount google drive for data and API key\n",
|
||||
" from google.colab import drive\n",
|
||||
"\n",
|
||||
|
||||
4
notebooks/get-text-from-image.ipynb
сгенерированный
4
notebooks/get-text-from-image.ipynb
сгенерированный
@ -39,9 +39,9 @@
|
||||
"if \"google.colab\" in str(get_ipython()):\n",
|
||||
" # update python version\n",
|
||||
" # install setuptools\n",
|
||||
" !pip install setuptools==61 -qqq\n",
|
||||
" # %pip install setuptools==61 -qqq\n",
|
||||
" # install ammico\n",
|
||||
" !pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" %pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" # mount google drive for data and API key\n",
|
||||
" from google.colab import drive\n",
|
||||
"\n",
|
||||
|
||||
4
notebooks/image_summary.ipynb
сгенерированный
4
notebooks/image_summary.ipynb
сгенерированный
@ -31,9 +31,9 @@
|
||||
"if \"google.colab\" in str(get_ipython()):\n",
|
||||
" # update python version\n",
|
||||
" # install setuptools\n",
|
||||
" !pip install setuptools==61 -qqq\n",
|
||||
" # %pip install setuptools==61 -qqq\n",
|
||||
" # install ammico\n",
|
||||
" !pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" %pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" # mount google drive for data and API key\n",
|
||||
" from google.colab import drive\n",
|
||||
"\n",
|
||||
|
||||
4
notebooks/multimodal_search.ipynb
сгенерированный
4
notebooks/multimodal_search.ipynb
сгенерированный
@ -34,9 +34,9 @@
|
||||
"if \"google.colab\" in str(get_ipython()):\n",
|
||||
" # update python version\n",
|
||||
" # install setuptools\n",
|
||||
" !pip install setuptools==61 -qqq\n",
|
||||
" # %pip install setuptools==61 -qqq\n",
|
||||
" # install ammico\n",
|
||||
" !pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" %pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" # mount google drive for data and API key\n",
|
||||
" from google.colab import drive\n",
|
||||
"\n",
|
||||
|
||||
4
notebooks/objects_expression.ipynb
сгенерированный
4
notebooks/objects_expression.ipynb
сгенерированный
@ -31,9 +31,9 @@
|
||||
"if \"google.colab\" in str(get_ipython()):\n",
|
||||
" # update python version\n",
|
||||
" # install setuptools\n",
|
||||
" !pip install setuptools==61 -qqq\n",
|
||||
" # %pip install setuptools==61 -qqq\n",
|
||||
" # install ammico\n",
|
||||
" !pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" %pip install git+https://github.com/ssciwr/ammico.git -qqq\n",
|
||||
" # mount google drive for data and API key\n",
|
||||
" from google.colab import drive\n",
|
||||
"\n",
|
||||
|
||||
Загрузка…
x
Ссылка в новой задаче
Block a user