Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
전준휘 committed Feb 10, 2021
0 parents commit ad2c852
Show file tree
Hide file tree
Showing 10 changed files with 4,042 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.jpg
/Origin_data/
/Wonbin_faces/
/MNIST_data/
/JUNI_Test_faces/
/custom_data/
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 4
}
69 changes: 69 additions & 0 deletions .ipynb_checkpoints/Image_Inverter-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import cv2\n",
"import glob\n",
"import matplotlib.pylab as plt\n",
"from PIL import Image"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'glob' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-4-130bf9e3720d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[0mfile_names\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlistdir\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile_path\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 9\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 10\u001b[1;33m \u001b[0mimages\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[0mcv2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mimread\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mfile\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mfile\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mglob\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mglob\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"custom_data\\gorilla/*.png\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 11\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mname\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mfile_names\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 12\u001b[0m \u001b[0mimg\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mImage\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mopen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'custom_data\\gorilla/1.jpg'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mNameError\u001b[0m: name 'glob' is not defined"
]
}
],
"source": [
"\n",
"\n",
"file_path = 'custom_data\\Wonbin_faces'\n",
"file_names = os.listdir(file_path)\n",
"i=1\n",
"images = [cv2.imread(file) for file in glob.glob(\"custom_data\\gorilla/*.png\")]\n",
"for name in file_names:\n",
" img = Image.open('custom_data\\gorilla/1.jpg')\n",
" plt.imshow(img)\n",
" \n",
" i += 1"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
160 changes: 160 additions & 0 deletions .ipynb_checkpoints/Image_Rename-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['1.JPG',\n",
" '10.JPG',\n",
" '100.JPG',\n",
" '101.JPG',\n",
" '102.JPG',\n",
" '103.JPG',\n",
" '104.JPG',\n",
" '11.JPG',\n",
" '12.JPG',\n",
" '13.JPG',\n",
" '14.JPG',\n",
" '15.JPG',\n",
" '16.JPG',\n",
" '17.JPG',\n",
" '18.JPG',\n",
" '19.JPG',\n",
" '2.JPG',\n",
" '20.JPG',\n",
" '21.JPG',\n",
" '22.JPG',\n",
" '23.JPG',\n",
" '24.JPG',\n",
" '25.JPG',\n",
" '26.JPG',\n",
" '27.JPG',\n",
" '28.JPG',\n",
" '29.JPG',\n",
" '3.JPG',\n",
" '30.JPG',\n",
" '31.JPG',\n",
" '32.JPG',\n",
" '33.JPG',\n",
" '34.JPG',\n",
" '35.JPG',\n",
" '36.JPG',\n",
" '37.JPG',\n",
" '38.JPG',\n",
" '39.JPG',\n",
" '4.JPG',\n",
" '40.JPG',\n",
" '41.JPG',\n",
" '42.JPG',\n",
" '43.JPG',\n",
" '44.JPG',\n",
" '45.JPG',\n",
" '46.JPG',\n",
" '47.JPG',\n",
" '48.JPG',\n",
" '49.JPG',\n",
" '5.JPG',\n",
" '50.JPG',\n",
" '51.JPG',\n",
" '52.JPG',\n",
" '53.JPG',\n",
" '54.JPG',\n",
" '55.JPG',\n",
" '56.JPG',\n",
" '57.JPG',\n",
" '58.JPG',\n",
" '59.JPG',\n",
" '6.JPG',\n",
" '60.JPG',\n",
" '61.JPG',\n",
" '62.JPG',\n",
" '63.JPG',\n",
" '64.JPG',\n",
" '65.JPG',\n",
" '66.JPG',\n",
" '67.JPG',\n",
" '68.JPG',\n",
" '69.JPG',\n",
" '7.JPG',\n",
" '70.JPG',\n",
" '71.JPG',\n",
" '72.JPG',\n",
" '73.JPG',\n",
" '74.JPG',\n",
" '75.JPG',\n",
" '76.JPG',\n",
" '77.JPG',\n",
" '78.JPG',\n",
" '79.JPG',\n",
" '8.JPG',\n",
" '80.JPG',\n",
" '81.JPG',\n",
" '82.JPG',\n",
" '83.JPG',\n",
" '84.JPG',\n",
" '85.JPG',\n",
" '86.JPG',\n",
" '87.JPG',\n",
" '88.JPG',\n",
" '89.JPG',\n",
" '9.JPG',\n",
" '90.JPG',\n",
" '91.JPG',\n",
" '92.JPG',\n",
" '93.JPG',\n",
" '94.JPG',\n",
" '95.JPG',\n",
" '96.JPG',\n",
" '97.JPG',\n",
" '98.JPG',\n",
" '99.JPG']"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"\n",
"# 주어진 디렉토리에 있는 항목들의 이름을 담고 있는 리스트를 반환합니다.\n",
"# 리스트는 임의의 순서대로 나열됩니다.\n",
"file_path = 'custom_data\\JUNI_faces'\n",
"file_names = os.listdir(file_path)\n",
"i = 1\n",
"for name in file_names:\n",
" src = os.path.join(file_path, name)\n",
" dst = 'JUNIstr(i) + '.jpg'\n",
" dst = os.path.join(file_path, dst)\n",
" os.rename(src, dst)\n",
" i += 1"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit ad2c852

Please sign in to comment.