Skip to content

Commit ae33497

Browse files
author
shixiaowen03
committed
transformer & deepfm step by step
1 parent 68a5f9c commit ae33497

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3460
-241
lines changed

.idea/workspace.xml

Lines changed: 320 additions & 241 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"from skimage import io\n",
10+
"import matplotlib.pyplot as plt\n",
11+
"\n",
12+
"num = 1\n",
13+
"\n",
14+
"\n",
15+
"def show():\n",
16+
" global num\n",
17+
"\n",
18+
"\n",
19+
" while (num < 5):\n",
20+
" img = io.imread('/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/' + str(num) + '.jpeg')\n",
21+
" io.imshow(img)\n",
22+
" plt.ion()\n",
23+
" plt.pause(0.01)\n",
24+
" #input(\"Press Enter to Continue\") # 之后改成识别输出\n",
25+
" num += 1"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"execution_count": 27,
31+
"metadata": {},
32+
"outputs": [
33+
{
34+
"name": "stdout",
35+
"output_type": "stream",
36+
"text": [
37+
"JPEG (200, 110) RGB\n",
38+
"JPEG (200, 150) RGB\n",
39+
"JPEG (200, 150) RGB\n",
40+
"JPEG (200, 112) RGB\n",
41+
"JPEG (200, 112) RGB\n",
42+
"JPEG (200, 133) RGB\n",
43+
"JPEG (200, 132) RGB\n",
44+
"JPEG (200, 120) RGB\n",
45+
"JPEG (187, 150) RGB\n",
46+
"JPEG (200, 122) RGB\n",
47+
"JPEG (200, 133) RGB\n",
48+
"JPEG (200, 120) RGB\n",
49+
"JPEG (200, 124) RGB\n",
50+
"JPEG (200, 150) RGB\n",
51+
"JPEG (200, 124) RGB\n",
52+
"JPEG (200, 150) RGB\n",
53+
"JPEG (200, 141) RGB\n",
54+
"JPEG (200, 132) RGB\n",
55+
"JPEG (200, 113) RGB\n",
56+
"JPEG (200, 112) RGB\n",
57+
"JPEG (200, 110) RGB\n",
58+
"JPEG (200, 150) RGB\n",
59+
"JPEG (200, 124) RGB\n",
60+
"JPEG (200, 120) RGB\n",
61+
"JPEG (187, 150) RGB\n",
62+
"JPEG (187, 150) RGB\n",
63+
"JPEG (200, 124) RGB\n",
64+
"JPEG (200, 130) RGB\n",
65+
"JPEG (200, 112) RGB\n",
66+
"JPEG (200, 150) RGB\n",
67+
"JPEG (200, 124) RGB\n",
68+
"JPEG (200, 134) RGB\n",
69+
"JPEG (200, 144) RGB\n",
70+
"JPEG (200, 112) RGB\n",
71+
"JPEG (200, 112) RGB\n",
72+
"JPEG (200, 112) RGB\n"
73+
]
74+
}
75+
],
76+
"source": [
77+
"from PIL import Image\n",
78+
"import glob\n",
79+
"img_path = glob.glob(\"/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/*.jpeg\")\n",
80+
"path_save = \"/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic\"\n",
81+
"for file in img_path:\n",
82+
" name = os.path.join(path_save, file)\n",
83+
" im = Image.open(file)\n",
84+
" im.thumbnail((200,150))\n",
85+
" print(im.format, im.size, im.mode)\n",
86+
" im.save(name,'JPEG')\n",
87+
"\n"
88+
]
89+
},
90+
{
91+
"cell_type": "code",
92+
"execution_count": 24,
93+
"metadata": {},
94+
"outputs": [
95+
{
96+
"name": "stdout",
97+
"output_type": "stream",
98+
"text": [
99+
"34\n",
100+
"35\n",
101+
"36\n"
102+
]
103+
}
104+
],
105+
"source": [
106+
"\n",
107+
"import matplotlib.pyplot as plt\n",
108+
"import imageio,os\n",
109+
"images = []\n",
110+
"num=34\n",
111+
"maxnum=36\n",
112+
"#filenames=sorted((fn for fn in os.listdir('/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/') if fn.endswith('.jpeg')))\n",
113+
"while (num <= maxnum):\n",
114+
" print(num)\n",
115+
" images.append(imageio.imread('/Users/meituan_sxw/PycharmProjects/tensorflow1.2/basic/pic/' + str(num) + '.jpeg'))\n",
116+
" num += 1\n",
117+
"imageio.mimsave('wangqiuwangzi.gif', images,duration=1)"
118+
]
119+
},
120+
{
121+
"cell_type": "code",
122+
"execution_count": null,
123+
"metadata": {},
124+
"outputs": [],
125+
"source": []
126+
},
127+
{
128+
"cell_type": "code",
129+
"execution_count": null,
130+
"metadata": {},
131+
"outputs": [],
132+
"source": []
133+
}
134+
],
135+
"metadata": {
136+
"kernelspec": {
137+
"display_name": "python35",
138+
"language": "python",
139+
"name": "python35"
140+
},
141+
"language_info": {
142+
"codemirror_mode": {
143+
"name": "ipython",
144+
"version": 3
145+
},
146+
"file_extension": ".py",
147+
"mimetype": "text/x-python",
148+
"name": "python",
149+
"nbconvert_exporter": "python",
150+
"pygments_lexer": "ipython3",
151+
"version": "3.5.2"
152+
}
153+
},
154+
"nbformat": 4,
155+
"nbformat_minor": 2
156+
}

basic/LR.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from sklearn.linear_model import LogisticRegression
2+
3+
import pandas as pd
4+
5+
import math
6+
7+
8+
data = pd.read_table('/Users/meituan_sxw/Downloads/flower.txt',header=None)
9+
10+
data.columns = ['f1','f2','f3','f4','flower']
11+
12+
data['label'] = data['flower'].map(lambda x:0 if x=='setosa' else 1)
13+
14+
print(data)
15+
x = data[['f1','f2','f3','f4']].values.tolist()
16+
y = data[['label']]
17+
18+
lr = LogisticRegression(penalty="l2",fit_intercept=False)
19+
20+
lr.fit(x,y)
21+
22+
print(lr.predict_proba(x))
23+
24+
print(1 / (1 + math.pow(math.e,5.1*(-0.40247392)+3.5*(-1.46382925)+1.4*2.23785648+0.2 * 1.00009294+(-0.25906453))))
25+
26+
27+
print(lr.coef_)
28+
29+
print(lr.__dict__)

basic/basic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,7 @@
148148

149149

150150

151+
152+
153+
154+

basic/donghua.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from skimage import io
2+
import matplotlib.pyplot as plt
3+
4+
num = 1
5+
6+
7+
def show():
8+
global num
9+
10+
11+
while (num < 5):
12+
img = io.imread('pi1c/' + str(num) + '.jpeg')
13+
io.imshow(img)
14+
plt.ion()
15+
plt.pause(0.01)
16+
input("Press Enter to Continue") # 之后改成识别输出
17+
num += 1
18+
19+
20+
21+
if __name__ == '__main__':
22+
show()

basic/gif.gif

534 KB

basic/gif/duolaameng.gif

66.2 KB

basic/gif/guangnengshizhe.gif

87.7 KB

basic/gif/labixiaoxin.gif

69 KB

basic/gif/lanmaotaoqi.gif

77.6 KB

0 commit comments

Comments
 (0)