白鹭先生 commited on
Commit
c9843cd
1 Parent(s): 6db7ee7
.gitignore ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ignore map, miou, datasets
2
+ datasets/archive/Dataset
3
+ model_data/best_epoch_weights.pth
4
+ metrics_out/
5
+
6
+ # Byte-compiled / optimized / DLL files
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+
11
+ # C extensions
12
+ *.so
13
+
14
+ # Distribution / packaging
15
+ .Python
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ downloads/
20
+ eggs/
21
+ .eggs/
22
+ lib/
23
+ lib64/
24
+ parts/
25
+ sdist/
26
+ var/
27
+ wheels/
28
+ pip-wheel-metadata/
29
+ share/python-wheels/
30
+ *.egg-info/
31
+ .installed.cfg
32
+ *.egg
33
+ MANIFEST
34
+
35
+ # PyInstaller
36
+ # Usually these files are written by a python script from a template
37
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
38
+ *.manifest
39
+ *.spec
40
+
41
+ # Installer logs
42
+ pip-log.txt
43
+ pip-delete-this-directory.txt
44
+
45
+ # Unit test / coverage reports
46
+ htmlcov/
47
+ .tox/
48
+ .nox/
49
+ .coverage
50
+ .coverage.*
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+ *.cover
55
+ *.py,cover
56
+ .hypothesis/
57
+ .pytest_cache/
58
+
59
+ # Translations
60
+ *.mo
61
+ *.pot
62
+
63
+ # Django stuff:
64
+ *.log
65
+ local_settings.py
66
+ db.sqlite3
67
+ db.sqlite3-journal
68
+
69
+ # Flask stuff:
70
+ instance/
71
+ .webassets-cache
72
+
73
+ # Scrapy stuff:
74
+ .scrapy
75
+
76
+ # Sphinx documentation
77
+ docs/_build/
78
+
79
+ # PyBuilder
80
+ target/
81
+
82
+ # Jupyter Notebook
83
+ .ipynb_checkpoints
84
+
85
+ # IPython
86
+ profile_default/
87
+ ipython_config.py
88
+
89
+ # pyenv
90
+ .python-version
91
+
92
+ # pipenv
93
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
+ # install all needed dependencies.
97
+ #Pipfile.lock
98
+
99
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
100
+ __pypackages__/
101
+
102
+ # Celery stuff
103
+ celerybeat-schedule
104
+ celerybeat.pid
105
+
106
+ # SageMath parsed files
107
+ *.sage.py
108
+
109
+ # Environments
110
+ .env
111
+ .venv
112
+ env/
113
+ venv/
114
+ ENV/
115
+ env.bak/
116
+ venv.bak/
117
+
118
+ # Spyder project settings
119
+ .spyderproject
120
+ .spyproject
121
+
122
+ # Rope project settings
123
+ .ropeproject
124
+
125
+ # mkdocs documentation
126
+ /site
127
+
128
+ # mypy
129
+ .mypy_cache/
130
+ .dmypy.json
131
+ dmypy.json
132
+
133
+ # Pyre type checker
134
+ .pyre/
AutoML.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''
2
+ Author: [egrt]
3
+ Date: 2022-08-14 09:37:12
4
+ LastEditors: [egrt]
5
+ LastEditTime: 2022-08-17 20:34:36
6
+ Description:
7
+ '''
8
+ import numpy as np
9
+ import pandas as pd
10
+ import pickle
11
+ from sklearn.preprocessing import LabelEncoder
12
+
13
+ def show_config(**kwargs):
14
+ print('Configurations:')
15
+ print('-' * 70)
16
+ print('|%25s | %40s|' % ('keys', 'values'))
17
+ print('-' * 70)
18
+ for key, value in kwargs.items():
19
+ print('|%25s | %40s|' % (str(key), str(value)))
20
+ print('-' * 70)
21
+
22
+ #--------------------------------------------#
23
+ # 使用自己训练好的模型预测需要修改3个参数
24
+ # model_path和classes_path和backbone都需要修改!
25
+ #--------------------------------------------#
26
+ class Classification(object):
27
+ _defaults = {
28
+ #--------------------------------------------------------------------------#
29
+ # 使用自己训练好的模型进行预测一定要修改model_path和classes_path!
30
+ # model_path指向logs文件夹下的权值文件,classes_path指向model_data下的txt
31
+ # 如果出现shape不匹配,同时要注意训练时的model_path和classes_path参数的修改
32
+ #--------------------------------------------------------------------------#
33
+ "model_path" : 'model_data/automl_v2.pkl',
34
+ "train_path" : 'datasets/archive/artworks.csv',
35
+ #-------------------------------#
36
+ # 是否使用Cuda
37
+ # 没有GPU可以设置成False
38
+ #-------------------------------#
39
+ "cuda" : False
40
+ }
41
+
42
+ @classmethod
43
+ def get_defaults(cls, n):
44
+ if n in cls._defaults:
45
+ return cls._defaults[n]
46
+ else:
47
+ return "Unrecognized attribute name '" + n + "'"
48
+
49
+ #---------------------------------------------------#
50
+ # 初始化classification
51
+ #---------------------------------------------------#
52
+ def __init__(self, **kwargs):
53
+ self.__dict__.update(self._defaults)
54
+ for name, value in kwargs.items():
55
+ setattr(self, name, value)
56
+
57
+ #---------------------------------------------------#
58
+ # 获得种类
59
+ #---------------------------------------------------#
60
+ self.num_classes = 1
61
+ self.train_data = pd.read_csv(self.train_path)
62
+ self.generate()
63
+
64
+ show_config(**self._defaults)
65
+
66
+ #---------------------------------------------------#
67
+ # 获得所有的分类
68
+ #---------------------------------------------------#
69
+ def generate(self):
70
+ #---------------------------------------------------#
71
+ # 载入模型与权值
72
+ #---------------------------------------------------#
73
+ with open("model_data/automl_v2.pkl", "rb") as f:
74
+ self.automl = pickle.load(f)
75
+
76
+ def detect_one(self, name, date, level, classification, height, width):
77
+ # 读取数据集
78
+ train_data = self.train_data
79
+ ArtistID = train_data.loc[train_data["Name"] == name, "Artist ID"][0]
80
+ # 对输入数据进行编码
81
+ la_Catalogue = LabelEncoder()
82
+ la_Catalogue.fit(train_data["Catalogue"])
83
+ Catalogue = la_Catalogue.transform(["Y"])
84
+
85
+ la_Department = LabelEncoder()
86
+ la_Department.fit(train_data["Department"])
87
+ Department = la_Department.transform([level])
88
+
89
+ la_Classification = LabelEncoder()
90
+ la_Classification.fit(train_data["Classification"])
91
+ Classification = la_Classification.transform([classification])
92
+ test_dict = {'Artist ID':ArtistID,'Date':date,'Department':Department,'Classification':Classification,
93
+ "Height (cm)":height, "Width (cm)":width}
94
+ test_data = pd.DataFrame(test_dict)
95
+
96
+ pred = self.automl.predict(test_data)
97
+ return int(pred[0])
98
+
99
+ if __name__ == "__main__":
100
+ classfication = Classification()
101
+ # classfication.get_result()
102
+ classfication.detect_one("陈冠夫", 1975, '国家级', '中国山水画', 50, 50)
app.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ '''
2
+ Author: [egrt]
3
+ Date: 2022-08-05 15:30:04
4
+ LastEditors: [egrt]
5
+ LastEditTime: 2022-08-17 20:36:44
6
+ Description:
7
+ '''
8
+ import os
9
+ os.system('pip install requirements.txt')
10
+ import gradio as gr
11
+ from AutoML import Classification
12
+
13
+ classfication = Classification()
14
+
15
+ with gr.Blocks() as demo:
16
+ with gr.Row():
17
+ with gr.Column():
18
+ name_box = gr.Textbox(label="艺术家姓名")
19
+ date_box = gr.Number(label="艺术品创作时间(年)")
20
+ classification_box = gr.CheckboxGroup(label="艺术品类型", choices=["中国山水画", "中国花鸟画", "风景油画",
21
+ "水粉画", "油画", "布面油画", "没骨画", "中国画"])
22
+ level_box = gr.CheckboxGroup(label="艺术家级别", choices=["国家级", "省级"])
23
+ height_box = gr.Number(label="艺术品高度(cm)")
24
+ width_box = gr.Number(label="艺术品宽度(cm)")
25
+
26
+ with gr.Column():
27
+ title_box = gr.Markdown("## 艺术品价值预测Demo")
28
+ image_box = gr.Image(label="艺术品照片", type='pil')
29
+ with gr.Row():
30
+ submit_btn = gr.Button("开始预测")
31
+ error_box = gr.Textbox(label="错误", visible=False)
32
+ with gr.Row(visible=False) as output_col:
33
+ prices_box = gr.Number(label="预测的艺术品价格(¥)")
34
+
35
+
36
+ def submit(name, date, classification, level, height, width, image):
37
+ # 填写信息错误则显示报错提示框
38
+ if len(name)==0 or len(classification)==0 or len(level) == 0 or image==None:
39
+ return {error_box: gr.update(value="请填写所有信息", visible=True)}
40
+ else:
41
+ # 正确预测之后则去除报错提示框
42
+ error_box: gr.update(visible=False)
43
+ prices = classfication.detect_one(name, date, level[0], classification[0], height, width)
44
+ return {
45
+ output_col: gr.update(visible=True),
46
+ prices_box: int(prices),
47
+ }
48
+
49
+ submit_btn.click(
50
+ submit,
51
+ [name_box, date_box, classification_box, level_box, height_box, width_box, image_box],
52
+ [error_box, prices_box, output_col],
53
+ )
54
+
55
+ demo.launch()
automl.ipynb ADDED
The diff for this file is too large to render. See raw diff
datasets/archive/artists.csv ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Artist ID,Name,Nationality,Gender,Birth Year,Death Year
2
+ 1,Ai Xuan 艾軒,Zhejiang,Male,1947,
3
+ 2,Chang DaiChien 張大千,Neijiang,Male,1899,1983
4
+ 3,Chu Chu 儲楚,Hangzhou,Female,1975,
5
+ 4,Giuseppe Castiglione 郎世宁,Italy,Male,1688,1766
6
+ 5,Gu Wenda 谷文达,Shanghai,Male,1955,
7
+ 6,He Baili 何百里,GuangZhou,Male,1945,
8
+ 7,He Jilan 何紀嵐,Hong Kong,Male,1974,
9
+ 9,Irene Chou 周綠雲,Shanghai,Female,1924,2011
10
+ 10,Jin TingBiao 金廷标,Huzhou,Male,1767,
11
+ 11,Li FangYing 李方膺,Jiangsu,Male,1696,1755
12
+ 12,Li Zijian 李自健,ShaoYang,Male,1954,
13
+ 13,Ling Jian 凌健,ShanDong,Male,1963,
14
+ 15,Liu KuoSung 刘国松,AnHui,Male,1932,
15
+ 16,Liu YuanShou 劉元壽,Beijing,Male,1967,
16
+ 18,Lu XinJian 陆新建,Jiangsu,Male,1977,
17
+ 19,Luo ZhongLi 羅中立,ChongQing,Male,1948,
18
+ 21,Qin Feng 秦风,XinJiang,Male,1961,
19
+ 22,Qiu Ying 仇英,Jiangsu,Male,1494,1552
20
+ 23,Wai Ming,Canton,Male,1938,
21
+ 24,Wang Hui 王翚,SuZhou,Male,1632,1717
22
+ 25,Yao WenHan 姚文瀚,顺天(今北京),Male,公元18世纪,公元18世纪
23
+ 26,Yu ZhiDing 禹之鼎,YangZhou,Male,1647,1709
24
+ 27,Zhang XiaoGang 张晓刚,KunMing,Male,1958,
25
+ 28,Zhao KaiLin 赵开霖,BengBu,Male,1961,
26
+ 30,Zou ChuanAn 邹传安,XinHua,Male,1941,
27
+ 31,,,,,
28
+ 32,,,,,
29
+ 33,,,,,
30
+ 34,,,,,
31
+ 35,,,,,
32
+ 36,,,,,
33
+ 37,,,,,
34
+ 38,,,,,
35
+ 39,,,,,
36
+ 40,,,,,
datasets/archive/artworks.csv ADDED
@@ -0,0 +1,319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Artwork ID,Title,Artist ID,Name,Date,Medium,Dimensions,Catalogue,Department,Classification,Height (cm),Length (cm),Width (cm),Depth (cm),Weight (kg),Duration (s),Prices
2
+ 1,拟古重彩山水之一,1,陈冠夫,1975,,,Y,国家级,中国山水画,50,,50,,,陈冠夫/Chen_Guang_Fu_01.jpg,4000
3
+ 2,拟古重彩山水之二,1,陈冠夫,1975,,,Y,国家级,中国山水画,50,,50,,,陈冠夫/Chen_Guang_Fu_02.jpg,4000
4
+ 3,拟古重彩山水之三,1,陈冠夫,1975,,,Y,国家级,中国山水画,50,,50,,,陈冠夫/Chen_Guang_Fu_03.jpg,4000
5
+ 4,团扇系列之一,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,45,,,陈冠夫/Chen_Guang_Fu_04.jpg,4000
6
+ 5,团扇系列之二,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,45,,,陈冠夫/Chen_Guang_Fu_05.jpg,4000
7
+ 6,团扇系列之三,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,45,,,陈冠夫/Chen_Guang_Fu_06.jpg,4000
8
+ 7,团扇系列之四,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,45,,,陈冠夫/Chen_Guang_Fu_07.jpg,4000
9
+ 8,团扇系列之五,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,45,,,陈冠夫/Chen_Guang_Fu_08.jpg,4000
10
+ 9,团扇系列之六,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,45,,,陈冠夫/Chen_Guang_Fu_09.jpg,4000
11
+ 10,天地有大美而不言,1,陈冠夫,1975,,,Y,国家级,中国山水画,67,,67,,,陈冠夫/Chen_Guang_Fu_10.jpg,4000
12
+ 11,春山淡妆,1,陈冠夫,1975,,,Y,国家级,中国山水画,60,,50,,,陈冠夫/Chen_Guang_Fu_11.jpg,4000
13
+ 12,意象.蜀山苍秀,1,陈冠夫,1975,,,Y,国家级,中国山水画,220,,160,,,陈冠夫/Chen_Guang_Fu_12.jpg,4000
14
+ 13,蜀山隐居,1,陈冠夫,1975,,,Y,国家级,中国山水画,55,,35,,,陈冠夫/Chen_Guang_Fu_13.jpg,4000
15
+ 14,山居问道,1,陈冠夫,1975,,,Y,国家级,中国山水画,55,,35,,,陈冠夫/Chen_Guang_Fu_14.jpg,4000
16
+ 15,春山悟道,1,陈冠夫,1975,,,Y,国家级,中国山水画,70,,40,,,陈冠夫/Chen_Guang_Fu_15.jpg,4000
17
+ 16,荆楚风雨过后 依旧山明水秀,1,陈冠夫,1975,,,Y,国家级,中国山水画,50,,120,,,陈冠夫/Chen_Guang_Fu_16.jpg,4000
18
+ 17,松涛.意象,1,陈冠夫,1975,,,Y,国家级,中国山水画,170,,90,,,陈冠夫/Chen_Guang_Fu_17.jpg,4000
19
+ 18,意象.蜀山苍秀,1,陈冠夫,1975,,,Y,国家级,中国山水画,220,,160,,,陈冠夫/Chen_Guang_Fu_18.jpg,4000
20
+ 19,天地·镜像系列之二,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,180,,,陈冠夫/Chen_Guang_Fu_19.jpg,4000
21
+ 20,意象?·水墨系列之三,1,陈冠夫,1975,,,Y,国家级,中国山水画,147,,50,,,陈冠夫/Chen_Guang_Fu_20.jpg,4000
22
+ 21,蜀山烟岚,1,陈冠夫,1975,,,Y,国家级,中国山水画,108,,45,,,陈冠夫/Chen_Guang_Fu_21.jpg,4000
23
+ 22,意象.水云间之一,1,陈冠夫,1975,,,Y,国家级,中国山水画,35,,67,,,陈冠夫/Chen_Guang_Fu_22.jpg,4000
24
+ 23,意象.水云间山水之二,1,陈冠夫,1975,,,Y,国家级,中国山水画,35,,67,,,陈冠夫/Chen_Guang_Fu_23.jpg,4000
25
+ 24,秋山流云,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,180,,,陈冠夫/Chen_Guang_Fu_24.jpg,4000
26
+ 25,墨彩系列之一,1,陈冠夫,1975,,,Y,国家级,中国山水画,45,,70,,,陈冠夫/Chen_Guang_Fu_25.jpg,4000
27
+ 26,春晓,2,梁时民,,,,Y,国家级,中国花鸟画,50,,50,,,梁时民/Liang_Shi_Ming_01.jpg,67500
28
+ 27,荷塘清露,2,梁时民,,,,Y,国家级,中国花鸟画,68,,68,,,梁时民/Liang_Shi_Ming_02.jpg,124848
29
+ 28,鸳鸯无限意 任尔烟鱼游,2,梁时民,,,,Y,国家级,中国花鸟画,136,,68,,,梁时民/Liang_Shi_Ming_03.jpg,249696
30
+ 29,百叶莲花万重香,2,梁时民,,,,Y,国家级,中国花鸟画,50,,50,,,梁时民/Liang_Shi_Ming_04.jpg,67500
31
+ 30,渊冰厚三尺 素雪覆千里,2,梁时民,,,,Y,国家级,中国花鸟画,68,,135,,,梁时民/Liang_Shi_Ming_05.jpg,247860
32
+ 31,晚秋,2,梁时民,,,,Y,国家级,中国花鸟画,136,,68,,,梁时民/Liang_Shi_Ming_06.jpg,249696
33
+ 32,风摇青玉枝,2,梁时民,,,,Y,国家级,中国花鸟画,68,,68,,,梁时民/Liang_Shi_Ming_07.jpg,124848
34
+ 33,暖冬,2,梁时民,,,,Y,国家级,中国花鸟画,192,,181,,,梁时民/Liang_Shi_Ming_08.jpg,938304
35
+ 34,初雪,2,梁时民,,,,Y,国家级,中国花鸟画,35,,35,,,梁时民/Liang_Shi_Ming_09.jpg,33075
36
+ 35,素秋,2,梁时民,,,,Y,国家级,中国花鸟画,68,,40,,,梁时民/Liang_Shi_Ming_10.jpg,73440
37
+ 36,包谷林,2,梁时民,,,,Y,国家级,中国花鸟画,181,,192,,,梁时民/Liang_Shi_Ming_11.jpg,938304
38
+ 37,山里回忆,3,邵智,,,,Y,国家级,风景油画,60,,50,,,邵智/Shao_Zhi_01.jpg,10000
39
+ 38,车里子,3,邵智,,,,Y,国家级,风景油画,60,,50,,,邵智/Shao_Zhi_02.jpg,10000
40
+ 39,硕果,3,邵智,,,,Y,国家级,风景油画,50,,60,,,邵智/Shao_Zhi_03.jpg,10000
41
+ 40,多仔多福,3,邵智,,,,Y,国家级,风景油画,50,,50,,,邵智/Shao_Zhi_04.jpg,10000
42
+ 41,一篮秋歌,3,邵智,,,,Y,国家级,风景油画,50,,50,,,邵智/Shao_Zhi_05.jpg,10000
43
+ 42,秋韵,3,邵智,,,,Y,国家级,风景油画,50,,50,,,邵智/Shao_Zhi_06.jpg,10000
44
+ 43,绿萝,3,邵智,,,,Y,国家级,风景油画,100,,60,,,邵智/Shao_Zhi_07.jpg,10000
45
+ 44,电吹风,3,邵智,,,,Y,国家级,风景油画,100,,60,,,邵智/Shao_Zhi_08.jpg,10000
46
+ 45,岁月如歌,3,邵智,,,,Y,国家级,风景油画,65,,85,,,邵智/Shao_Zhi_09.jpg,10000
47
+ 46,寻梅,3,邵智,,,,Y,国家级,风景油画,85,,65,,,邵智/Shao_Zhi_10.jpg,10000
48
+ 47,清影,3,邵智,,,,Y,国家级,风景油画,60,,50,,,邵智/Shao_Zhi_11.jpg,10000
49
+ 48,荷香幽蓝,3,邵智,,,,Y,国家级,风景油画,50,,60,,,邵智/Shao_Zhi_12.jpg,10000
50
+ 49,今夕何夕,3,邵智,,,,Y,国家级,风景油画,60,,50,,,邵智/Shao_Zhi_13.jpg,10000
51
+ 50,笔下春秋,3,邵智,,,,Y,国家级,风景油画,60,,50,,,邵智/Shao_Zhi_14.jpg,10000
52
+ 51,西游记,3,邵智,,,,Y,国家级,风景油画,50,,50,,,邵智/Shao_Zhi_15.jpg,10000
53
+ 52,爷爷的灯,3,邵智,,,,Y,国家级,风景油画,90,,120,,,邵智/Shao_Zhi_16.jpg,10000
54
+ 53,婚事,3,邵智,,,,Y,国家级,风景油画,80,,110,,,邵智/Shao_Zhi_17.jpg,10000
55
+ 54,兄弟,3,邵智,,,,Y,国家级,风景油画,80,,110,,,邵智/Shao_Zhi_18.jpg,10000
56
+ 55,解放大西南,3,邵智,,,,Y,国家级,风景油画,160,,220,,,邵智/Shao_Zhi_19.jpg,10000
57
+ 56,昊天,3,邵智,,,,Y,国家级,风景油画,110,,90,,,邵智/Shao_Zhi_20.jpg,10000
58
+ 57,回娘家,3,邵智,,,,Y,国家级,风景油画,80,,100,,,邵智/Shao_Zhi_21.jpg,10000
59
+ 58,回望家园,3,邵智,,,,Y,国家级,风景油画,110,,90,,,邵智/Shao_Zhi_22.jpg,10000
60
+ 59,古镇晨曲,3,邵智,,,,Y,国家级,风景油画,70,,100,,,邵智/Shao_Zhi_23.jpg,10000
61
+ 60,故乡的小河2,3,邵智,,,,Y,国家级,风景油画,65,,75,,,邵智/Shao_Zhi_24.jpg,10000
62
+ 61,彝海情深,3,邵智,,,,Y,国家级,风景油画,70,,120,,,邵智/Shao_Zhi_25.jpg,10000
63
+ 62,最后的净土,3,邵智,,,,Y,国家级,风景油画,120,,360,,,邵智/Shao_Zhi_26.jpg,10000
64
+ 63,吉祥富贵,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_01.jpg,249696
65
+ 64,吉祥富贵图,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_02.jpg,249696
66
+ 65,春来了,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_03.jpg,249696
67
+ 66,迎春,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_04.jpg,249696
68
+ 67,飞吧,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_05.jpg,249696
69
+ 68,无题,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_06.jpg,249696
70
+ 69,春长在,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_07.jpg,249696
71
+ 70,无 题,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_08.jpg,249696
72
+ 71,初温,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_09.jpg,249696
73
+ 72,无 题,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_10.jpg,249696
74
+ 73,腾 飞,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_11.jpg,249696
75
+ 74,秋趣,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_12.jpg,249696
76
+ 75,初温,4,谭昌镕,1933,,,Y,国家级,中国花鸟画,136,,68,,,谭昌镕/Tang_Chang_Rong_13.jpg,249696
77
+ 76,百花系列之牡丹,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_01.jpg,56511
78
+ 77,百花系列之白芍药,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_02.jpg,56511
79
+ 78,百花系列之高山杜鹃,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_03.jpg,56511
80
+ 79,百花系列之红山茶,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_04.jpg,56511
81
+ 80,百花系列之箭杆花,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_05.jpg,56511
82
+ 81,百花系列之红棉,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_06.jpg,56511
83
+ 82,百花系列之红掌,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_07.jpg,55703.7
84
+ 83,百花系列之牵牛花,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_08.jpg,56511
85
+ 84,百花系列之荷花,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,70,,,汪晓灵/Wang_Xiao_Ling_09.jpg,56511
86
+ 85,百花系列之梨花,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_10.jpg,55703.7
87
+ 86,百花系列之铁脚海棠,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_11.jpg,55703.7
88
+ 87,百花系列之旱金莲,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_12.jpg,55703.7
89
+ 88,百花系列之黄花槐,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_13.jpg,55703.7
90
+ 89,百花系列之菊花,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_14.jpg,55703.7
91
+ 90,秋晨,5,汪晓灵,,,,Y,国家级,中国花鸟画,34,,45,,,汪晓灵/Wang_Xiao_Ling_15.jpg,17901
92
+ 91,泸沽湖上,5,汪晓灵,,,,Y,国家级,中国花鸟画,89,,45.5,,,汪晓灵/Wang_Xiao_Ling_16.jpg,47379.15
93
+ 92,晨牧,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_17.jpg,55703.7
94
+ 93,荷塘月色,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_18.jpg,55703.7
95
+ 94,良宵,5,汪晓灵,,,,Y,国家级,中国花鸟画,69,,69,,,汪晓灵/Wang_Xiao_Ling_19.jpg,55703.7
96
+ 95,蓝天之歌,5,汪晓灵,,,,Y,国家级,中国花鸟画,35,,45,,,汪晓灵/Wang_Xiao_Ling_20.jpg,18427.5
97
+ 96,高山流水图,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,35,,,车晓葵/Che_Xiao_Kui_01.jpg,5000
98
+ 97,好风光,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,35,,,车晓葵/Che_Xiao_Kui_02.jpg,5000
99
+ 98,赞梅,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,35,,,车晓葵/Che_Xiao_Kui_03.jpg,5000
100
+ 99,枇杷果果,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,35,,,车晓葵/Che_Xiao_Kui_04.jpg,5000
101
+ 100,雅香,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,35,,,车晓葵/Che_Xiao_Kui_05.jpg,5000
102
+ 101,情趣,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,35,,,车晓葵/Che_Xiao_Kui_06.jpg,5000
103
+ 102,开口笑,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,35,,,车晓葵/Che_Xiao_Kui_07.jpg,5000
104
+ 103,天香,6,车晓葵,1953,,,Y,国家级,中国花鸟画,69,,69,,,车晓葵/Che_Xiao_Kui_08.jpg,5000
105
+ 104,荷塘秋果,6,车晓葵,1953,,,Y,国家级,中国花鸟画,69,,69,,,车晓葵/Che_Xiao_Kui_09.jpg,5000
106
+ 105,紫藤小鸟图,6,车晓葵,1953,,,Y,国家级,中国花鸟画,69,,69,,,车晓葵/Che_Xiao_Kui_10.jpg,5000
107
+ 106,春花正茂,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,70,,,车晓葵/Che_Xiao_Kui_11.jpg,5000
108
+ 107,国色天香,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,110,,,车晓葵/Che_Xiao_Kui_12.jpg,5000
109
+ 108,荷塘月色,6,车晓葵,1953,,,Y,国家级,中国花鸟画,52,,155,,,车晓葵/Che_Xiao_Kui_13.jpg,5000
110
+ 109,春暖花开春常在,6,车晓葵,1953,,,Y,国家级,中国花鸟画,52,,223,,,车晓葵/Che_Xiao_Kui_14.jpg,5000
111
+ 110,春、夏、秋、冬,6,车晓葵,1953,,,Y,国家级,中国花鸟画,50,,208,,,车晓葵/Che_Xiao_Kui_15.jpg,5000
112
+ 111,春满人间,6,车晓葵,1953,,,Y,国家级,中国花鸟画,69,,138,,,车晓葵/Che_Xiao_Kui_16.jpg,5000
113
+ 112,紫气东来,6,车晓葵,1953,,,Y,国家级,中国花鸟画,69,,138,,,车晓葵/Che_Xiao_Kui_17.jpg,5000
114
+ 113,志在云天,6,车晓葵,1953,,,Y,国家级,中国花鸟画,69,,138,,,车晓葵/Che_Xiao_Kui_18.jpg,5000
115
+ 114,荷塘月色,6,车晓葵,1953,,,Y,国家级,中国花鸟画,69,,136,,,车晓葵/Che_Xiao_Kui_19.jpg,5000
116
+ 115,紫气迎春,6,车晓葵,1953,,,Y,国家级,中国花鸟画,120,,245,,,车晓葵/Che_Xiao_Kui_20.jpg,5000
117
+ 116,出水荷花香,6,车晓葵,1953,,,Y,国家级,中国花鸟画,97,,180,,,车晓葵/Che_Xiao_Kui_21.jpg,5000
118
+ 117,福禄大吉图,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,140,,,车晓葵/Che_Xiao_Kui_22.jpg,5000
119
+ 118,思语,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,120,,,车晓葵/Che_Xiao_Kui_23.jpg,5000
120
+ 119,凌云图,6,车晓葵,1953,,,Y,国家级,中国花鸟画,35,,140,,,车晓葵/Che_Xiao_Kui_24.jpg,5000
121
+ 117,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_01.jpg,216000
122
+ 118,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_02.jpg,216000
123
+ 119,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_03.jpg,216000
124
+ 120,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_04.jpg,216000
125
+ 121,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_05.jpg,216000
126
+ 122,,7,何学斌,,,,Y,国家级,中国山水画,98,,180,,,何学斌/He_Xue_Bin_06.jpg,793800
127
+ 123,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_07.jpg,216000
128
+ 124,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_08.jpg,216000
129
+ 125,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_09.jpg,216000
130
+ 126,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_10.jpg,216000
131
+ 127,,7,何学斌,,,,Y,国家级,中国山水画,120,,50,,,何学斌/He_Xue_Bin_11.jpg,270000
132
+ 128,,7,何学斌,,,,Y,国家级,中国山水画,120,,50,,,何学斌/He_Xue_Bin_12.jpg,270000
133
+ 129,,7,何学斌,,,,Y,国家级,中国山水画,120,,50,,,何学斌/He_Xue_Bin_13.jpg,216000
134
+ 130,,7,何学斌,,,,Y,国家级,中国山水画,120,,40,,,何学斌/He_Xue_Bin_14.jpg,216000
135
+ 131,九寨沟小景一,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_01.jpg,5000
136
+ 132,九寨沟小景二,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_02.jpg,5000
137
+ 133,九寨沟小景三,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_03.jpg,5000
138
+ 134,小品一,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_04.jpg,5000
139
+ 135,小品二,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_05.jpg,5000
140
+ 136,小品三,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_06.jpg,5000
141
+ 137,小品四,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_07.jpg,5000
142
+ 138,小品五,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_08.jpg,5000
143
+ 139,小品六,8,冷蓉,,,,Y,国家级,中国山水画,45,,45,,,冷蓉/Leng_Rong_09.jpg,5000
144
+ 140,黄龙溪写生一,8,冷蓉,,,,Y,国家级,中国山水画,50,,50,,,冷蓉/Leng_Rong_10.jpg,5000
145
+ 141,黄龙溪写生二,8,冷蓉,,,,Y,国家级,中国山水画,50,,50,,,冷蓉/Leng_Rong_11.jpg,5000
146
+ 142,黄龙溪写生三,8,冷蓉,,,,Y,国家级,中国山水画,50,,50,,,冷蓉/Leng_Rong_12.jpg,5000
147
+ 143,黄龙溪写生四,8,冷蓉,,,,Y,国家级,中国山水画,50,,50,,,冷蓉/Leng_Rong_13.jpg,5000
148
+ 144,达古山下,8,冷蓉,,,,Y,国家级,中国山水画,125,,240,,,冷蓉/Leng_Rong_14.jpg,5000
149
+ 145,柳江小镇,8,冷蓉,,,,Y,国家级,中国山水画,98,,180,,,冷蓉/Leng_Rong_15.jpg,5000
150
+ 146,羌山妙语话家园,8,冷蓉,,,,Y,国家级,中国山水画,190,,230,,,冷蓉/Leng_Rong_16.jpg,5000
151
+ 147,更喜岷山千里雪,8,冷蓉,,,,Y,国家级,中国山水画,125,,200,,,冷蓉/Leng_Rong_17.jpg,5000
152
+ 148,蜀山画意浓,8,冷蓉,,,,Y,国家级,中国山水画,98,,180,,,冷蓉/Leng_Rong_18.jpg,5000
153
+ 166,园林印象,10,缪玲,,,,Y,国家级,中国花鸟画,240,,120,,,缪玲/Miu_Ling_01.jpg,8000
154
+ 167,金陵寻梦,10,缪玲,,,,Y,国家级,中国花鸟画,180,,96,,,缪玲/Miu_Ling_02.jpg,8000
155
+ 168,乡愁,10,缪玲,,,,Y,国家级,中国花鸟画,180,,180,,,缪玲/Miu_Ling_03.jpg,8000
156
+ 169,故园清梦,10,缪玲,,,,Y,国家级,中国花鸟画,90,,90,,,缪玲/Miu_Ling_04.jpg,8000
157
+ 171,秋 语,10,缪玲,,,,Y,国家级,中国花鸟画,240,,160,,,缪玲/Miu_Ling_06.jpg,8000
158
+ 172,秋韵,10,缪玲,,,,Y,国家级,中国花鸟画,195,,180,,,缪玲/Miu_Ling_07.jpg,8000
159
+ 173,山间语,10,缪玲,,,,Y,国家级,中国花鸟画,136,,98,,,缪玲/Miu_Ling_08.jpg,8000
160
+ 174,藏家小景,10,缪玲,,,,Y,国家级,中国花鸟画,68,,48,,,缪玲/Miu_Ling_09.jpg,8000
161
+ 175,园林赋,10,缪玲,,,,Y,国家级,中国花鸟画,180,,97,,,缪玲/Miu_Ling_10.jpg,8000
162
+ 176,桃花源记,10,缪玲,,,,Y,国家级,中国花鸟画,136,,98,,,缪玲/Miu_Ling_11.jpg,8000
163
+ 177,园林深处待人归,10,缪玲,,,,Y,国家级,中国花鸟画,180,,97,,,缪玲/Miu_Ling_12.jpg,8000
164
+ 178,游园惊梦,10,缪玲,,,,Y,国家级,中国花鸟画,180,,97,,,缪玲/Miu_Ling_13.jpg,8000
165
+ 179,园中秋景,10,缪玲,,,,Y,国家级,中国花鸟画,65,,57,,,缪玲/Miu_Ling_14.jpg,8000
166
+ 180,远上寒石径斜,10,缪玲,,,,Y,国家级,中国花鸟画,136,,68,,,缪玲/Miu_Ling_15.jpg,8000
167
+ 181,沁园,10,缪玲,,,,Y,国家级,中国花鸟画,78,,68,,,缪玲/Miu_Ling_16.jpg,8000
168
+ 182,林中音,10,缪玲,,,,Y,国家级,中国花鸟画,58,,60,,,缪玲/Miu_Ling_17.jpg,8000
169
+ 183,寒园,10,缪玲,,,,Y,国家级,中国花鸟画,68,,136,,,缪玲/Miu_Ling_18.jpg,8000
170
+ 184,故园,10,缪玲,,,,Y,国家级,中国花鸟画,68,,136,,,缪玲/Miu_Ling_19.jpg,8000
171
+ 185,园中亭,10,缪玲,,,,Y,国家级,中国花鸟画,58,,60,,,缪玲/Miu_Ling_20.jpg,8000
172
+ 186,蝶恋花,10,缪玲,,,,Y,国家级,中国花鸟画,68,,68,,,缪玲/Miu_Ling_21.jpg,8000
173
+ 187,花鸟团扇,10,缪玲,,,,Y,国家级,中国花鸟画,42,,42,,,缪玲/Miu_Ling_22.jpg,8000
174
+ 188,蝶恋花,10,缪玲,,,,Y,国家级,中国花鸟画,42,,42,,,缪玲/Miu_Ling_23.jpg,8000
175
+ 236,清赏,13,吴洪涛,,,,Y,国家级,中国花鸟画,54,,70,,,吴洪涛/Wu_Hong_Tao_02.jpg,16329.6
176
+ 238,神存富贵,13,吴洪涛,,,,Y,国家级,中国花鸟画,46,,138,,,吴洪涛/Wu_Hong_Tao_04.jpg,27423.36
177
+ 239,相逢何处不依依,13,吴洪涛,,,,Y,国家级,中国花鸟画,48,,168,,,吴洪涛/Wu_Hong_Tao_05.jpg,34836.48
178
+ 240,清涟,13,吴洪涛,,,,Y,国家级,中国花鸟画,35,,35,,,吴洪涛/Wu_Hong_Tao_06.jpg,5292
179
+ 242,轻步临波,13,吴洪涛,,,,Y,国家级,中国花鸟画,48,,48,,,吴洪涛/Wu_Hong_Tao_08.jpg,9953.28
180
+ 245,相携何从,13,吴洪涛,,,,Y,国家级,中国花鸟画,141,,48,,,吴洪涛/Wu_Hong_Tao_11.jpg,29237.76
181
+ 246,几生修得到梅花,13,吴洪涛,,,,Y,国家级,中国花鸟画,188,,169,,,吴洪涛/Wu_Hong_Tao_12.jpg,137255.04
182
+ 247,何须惆怅忆芳容,13,吴洪涛,,,,Y,国家级,中国花鸟画,48,,168,,,吴洪涛/Wu_Hong_Tao_13.jpg,34836.48
183
+ 248,君子林,13,吴洪涛,,,,Y,国家级,中国花鸟画,211,,88,,,吴洪涛/Wu_Hong_Tao_14.jpg,80213.76
184
+ 249,忽闻疏雨打新荷,13,吴洪涛,,,,Y,国家级,中国花鸟画,48,,68,,,吴洪涛/Wu_Hong_Tao_15.jpg,14100.48
185
+ 250,护花千里系长藤,13,吴洪涛,,,,Y,国家级,中国花鸟画,198,,48,,,吴洪涛/Wu_Hong_Tao_16.jpg,41057.28
186
+ 1,马兰的辉煌——我国第一颗原子弹爆炸成功,15,筱慧,,,,Y,国家级,水粉画,80,,60,,,筱慧/Xiao_Hui_01.jpg,5000
187
+ 2,路旁小景,15,筱慧,,,,Y,国家级,水粉画,53,,37,,,筱慧/Xiao_Hui_02.jpg,5000
188
+ 3,松坪沟白蜡下海,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_03.jpg,5000
189
+ 4,松坪沟小景,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_04.jpg,5000
190
+ 5,松坪沟白蜡湖,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_05.jpg,5000
191
+ 6,松坪沟秋韵,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_06.jpg,5000
192
+ 7,秋韵浓,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_07.jpg,5000
193
+ 8,松坪沟红桦树,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_08.jpg,5000
194
+ 9,溪 流,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_09.jpg,5000
195
+ 10,薰衣草盛开的地方,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_10.jpg,5000
196
+ 11,光雾山晨曦,15,筱慧,,,,Y,国家级,水粉画,60,,80,,,筱慧/Xiao_Hui_11.jpg,5000
197
+ 12,光雾山之春,15,筱慧,,,,Y,国家级,水粉画,30,,40,,,筱慧/Xiao_Hui_12.jpg,5000
198
+ 13,光雾山之夏,15,筱慧,,,,Y,国家级,水粉画,30,,40,,,筱慧/Xiao_Hui_13.jpg,5000
199
+ 14,光雾山之秋,15,筱慧,,,,Y,国家级,水粉画,30,,40,,,筱慧/Xiao_Hui_14.jpg,5000
200
+ 15,光雾山之冬,15,筱慧,,,,Y,国家级,水粉画,30,,40,,,筱慧/Xiao_Hui_15.jpg,5000
201
+ 16,九寨沟秋色,15,筱慧,,,,Y,国家级,水粉画,40,,60,,,筱慧/Xiao_Hui_16.jpg,5000
202
+ 17,九寨沟珍珠滩,15,筱慧,,,,Y,国家级,水粉画,40,,60,,,筱慧/Xiao_Hui_17.jpg,5000
203
+ 18,绿水白石,15,筱慧,,,,Y,国家级,水彩画,100,,160,,,筱慧/Xiao_Hui_18.jpg,5000
204
+ 19,聚宝盆,15,筱慧,,,,Y,国家级,油画,60,,80,,,筱慧/Xiao_Hui_19.jpg,5000
205
+ 20,装饰花卉,15,筱慧,,,,Y,国家级,水粉画,40,,60,,,筱慧/Xiao_Hui_20.jpg,5000
206
+ 21,鱼塘春色,15,筱慧,,,,Y,国家级,油画,60,,80,,,筱慧/Xiao_Hui_21.jpg,5000
207
+ 22,花 卉,15,筱慧,,,,Y,国家级,油画,60,,80,,,筱慧/Xiao_Hui_22.jpg,5000
208
+ 23,葵花向阳,15,筱慧,,,,Y,国家级,水彩画,52,,37,,,筱慧/Xiao_Hui_23.jpg,5000
209
+ 24,成都市花-芙蓉花,15,筱慧,,,,Y,国家级,水彩画,100,,160,,,筱慧/Xiao_Hui_24.jpg,5000
210
+ 25,虞美人,15,筱慧,,,,Y,国家级,水彩画,52,,37,,,筱慧/Xiao_Hui_25.jpg,5000
211
+ 26,三角梅,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_26.jpg,5000
212
+ 27,硕果累累,15,筱慧,,,,Y,国家级,水粉画,52,,37,,,筱慧/Xiao_Hui_27.jpg,5000
213
+ 28,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_01.jpg,4000
214
+ 29,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_02.jpg,4000
215
+ 30,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_03.jpg,4000
216
+ 31,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_04.jpg,4000
217
+ 32,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_05.jpg,4000
218
+ 33,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_06.jpg,4000
219
+ 34,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_07.jpg,4000
220
+ 35,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_08.jpg,4000
221
+ 36,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_09.jpg,4000
222
+ 37,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_10.jpg,4000
223
+ 38,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_11.jpg,4000
224
+ 39,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_12.jpg,4000
225
+ 40,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_13.jpg,4000
226
+ 41,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_14.jpg,4000
227
+ 42,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_15.jpg,4000
228
+ 43,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_16.jpg,4000
229
+ 44,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_17.jpg,4000
230
+ 45,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_18.jpg,4000
231
+ 46,,16,徐小丹,1982,,,Y,国家级,油画,60,,80,,,徐小丹/Xu_Xiao_Dan_19.jpg,4000
232
+ 47,工业物语之一,17,杨绍刚,,,,Y,国家级,布面油画,60,,80,,,杨绍刚/Yang_Shao_Gang_01.jpg,20000
233
+ 48,工业物语之二,17,杨绍刚,,,,Y,国家级,布面油画,70,,70,,,杨绍刚/Yang_Shao_Gang_02.jpg,20000
234
+ 49,工业物语之三,17,杨绍刚,,,,Y,国家级,布面油画,70,,70,,,杨绍刚/Yang_Shao_Gang_03.jpg,20000
235
+ 50,工业物语之四,17,杨绍刚,,,,Y,国家级,布面油画,70,,70,,,杨绍刚/Yang_Shao_Gang_04.jpg,20000
236
+ 51,跨 越,17,杨绍刚,,,,Y,国家级,布面油画,190,,110,,,杨绍刚/Yang_Shao_Gang_05.jpg,20000
237
+ 52,落 红,17,杨绍刚,,,,Y,国家级,布面油画,130,,110,,,杨绍刚/Yang_Shao_Gang_06.jpg,20000
238
+ 53,沐 光,17,杨绍刚,,,,Y,国家级,布面油画,160,,120,,,杨绍刚/Yang_Shao_Gang_07.jpg,20000
239
+ 54,弃场系列之厂院,17,杨绍刚,,,,Y,国家级,布面油画,60,,80,,,杨绍刚/Yang_Shao_Gang_08.jpg,20000
240
+ 55,弃场系列之晨光,17,杨绍刚,,,,Y,国家级,布面油画,60,,80,,,杨绍刚/Yang_Shao_Gang_09.jpg,20000
241
+ 56,太阳雨系列之残阳如血,17,杨绍刚,,,,Y,国家级,布面油画,60,,80,,,杨绍刚/Yang_Shao_Gang_10.jpg,20000
242
+ 57,太阳雨系列之晨光,17,杨绍刚,,,,Y,国家级,布面油画,120,,120,,,杨绍刚/Yang_Shao_Gang_11.jpg,20000
243
+ 58,太阳雨系列之倒影,17,杨绍刚,,,,Y,国家级,布面油画,60,,80,,,杨绍刚/Yang_Shao_Gang_12.jpg,20000
244
+ 59,太阳雨系列之辉煌都市,17,杨绍刚,,,,Y,国家级,布面油画,120,,120,,,杨绍刚/Yang_Shao_Gang_13.jpg,20000
245
+ 60,太阳雨系列之落红,17,杨绍刚,,,,Y,国家级,布面油画,60,,80,,,杨绍刚/Yang_Shao_Gang_14.jpg,20000
246
+ 61,太阳雨系列之夕阳,17,杨绍刚,,,,Y,国家级,布面油画,60,,80,,,杨绍刚/Yang_Shao_Gang_15.jpg,20000
247
+ 62,西藏壁画印象之一,18,臧跃军,1958,,,Y,国家级,中国画,450,,250,,,臧跃军/Zang_Yue_Jun_01.jpg,5000
248
+ 63,西藏壁画印象之二,18,臧跃军,1958,,,Y,国家级,中国画,136,,68,,,臧跃军/Zang_Yue_Jun_02.jpg,5000
249
+ 64,西藏壁画印象之三,18,臧跃军,1958,,,Y,国家级,中国画,136,,68,,,臧跃军/Zang_Yue_Jun_03.jpg,5000
250
+ 65,西藏壁画印象之四,18,臧跃军,1958,,,Y,国家级,中国画,198,,98,,,臧跃军/Zang_Yue_Jun_04.jpg,5000
251
+ 66,西藏壁画印象之五,18,臧跃军,1958,,,Y,国家级,中国画,98,,68,,,臧跃军/Zang_Yue_Jun_05.jpg,5000
252
+ 67,西藏壁画印象之六,18,臧跃军,1958,,,Y,国家级,中国画,98,,68,,,臧跃军/Zang_Yue_Jun_06.jpg,5000
253
+ 68,西藏壁画印象之七,18,臧跃军,1958,,,Y,国家级,中国画,58,,48,,,臧跃军/Zang_Yue_Jun_07.jpg,5000
254
+ 69,西藏壁画印象之九,18,臧跃军,1958,,,Y,国家级,中国画,98,,98,,,臧跃军/Zang_Yue_Jun_08.jpg,5000
255
+ 70,西藏壁画系列之二,18,臧跃军,1958,,,Y,国家级,中国画,68,,47,,,臧跃军/Zang_Yue_Jun_09.jpg,5000
256
+ 71,西藏壁画系列之三,18,臧跃军,1958,,,Y,国家级,中国画,68,,47,,,臧跃军/Zang_Yue_Jun_10.jpg,5000
257
+ 72,西藏壁画系列之四,18,臧跃军,1958,,,Y,国家级,中国画,68,,47,,,臧跃军/Zang_Yue_Jun_11.jpg,5000
258
+ 73,西藏壁画系列之六,18,臧跃军,1958,,,Y,国家级,中国画,68,,47,,,臧跃军/Zang_Yue_Jun_12.jpg,5000
259
+ 74,佛眼中的布达拉,18,臧跃军,1958,,,Y,国家级,中国画,200,,200,,,臧跃军/Zang_Yue_Jun_13.jpg,5000
260
+ 75,心灵佛光四一,18,臧跃军,1958,,,Y,国家级,中国画,86.5,,125,,,臧跃军/Zang_Yue_Jun_14.jpg,5000
261
+ 76,新疆壁画印象(童子),18,臧跃军,1958,,,Y,国家级,中国画,138,,68,,,臧跃军/Zang_Yue_Jun_15.jpg,5000
262
+ 77,神牛系列之一,18,臧跃军,1958,,,Y,国家级,中国画,140,,76,,,臧跃军/Zang_Yue_Jun_16.jpg,5000
263
+ 78,神牛系列之二,18,臧跃军,1958,,,Y,国家级,中国画,76,,68,,,臧跃军/Zang_Yue_Jun_17.jpg,5000
264
+ 79,神牛系列之三,18,臧跃军,1958,,,Y,国家级,中国画,140,,76,,,臧跃军/Zang_Yue_Jun_18.jpg,5000
265
+ 80,神牛系列之五,18,臧跃军,1958,,,Y,国家级,中国画,140,,76,,,臧跃军/Zang_Yue_Jun_19.jpg,5000
266
+ 81,牧 归,18,臧跃军,1958,,,Y,国家级,中国画,46,,69,,,臧跃军/Zang_Yue_Jun_20.jpg,5000
267
+ 82,牧 归,18,臧跃军,1958,,,Y,国家级,中国画,68,,47,,,臧跃军/Zang_Yue_Jun_21.jpg,5000
268
+ 83,牧归之二,18,臧跃军,1958,,,Y,国家级,中国画,198,,98,,,臧跃军/Zang_Yue_Jun_22.jpg,5000
269
+ 84,风情高原,18,臧跃军,1958,,,Y,国家级,中国画,68,,46,,,臧跃军/Zang_Yue_Jun_23.jpg,5000
270
+ 85,高原风情,18,臧跃军,1958,,,Y,国家级,中国画,180,,200,,,臧跃军/Zang_Yue_Jun_24.jpg,5000
271
+ 86,雄 风,18,臧跃军,1958,,,Y,国家级,中国画,100,,54,,,臧跃军/Zang_Yue_Jun_25.jpg,5000
272
+ 87,小画系列之一,18,臧跃军,1958,,,Y,国家级,中国画,23,,80,,,臧跃军/Zang_Yue_Jun_26.jpg,5000
273
+ 88,小画系列之二,18,臧跃军,1958,,,Y,国家级,中国画,23,,80,,,臧跃军/Zang_Yue_Jun_27.jpg,5000
274
+ 89,放牧图,18,臧跃军,1958,,,Y,国家级,中国画,50,,76,,,臧跃军/Zang_Yue_Jun_28.jpg,5000
275
+ 90,风雪牦牛之一,18,臧跃军,1958,,,Y,国家级,中国画,97,,180,,,臧跃军/Zang_Yue_Jun_29.jpg,5000
276
+ 91,漫漫风雪路,18,臧跃军,1958,,,Y,国家级,中国画,505,,192,,,臧跃军/Zang_Yue_Jun_30.jpg,5000
277
+ 108,梳妆图,20,张学万,1958,,,Y,国家级,没骨画,68,,68,,,张学万/Zhang_Xue_Wan_01.jpg,12484.8
278
+ 109,丽人行诗意图,20,张学万,1958,,,Y,国家级,没骨画,68,,126,,,张学万/Zhang_Xue_Wan_02.jpg,23133.6
279
+ 110,春风得意丽人行,20,张学万,1958,,,Y,国家级,没骨画,136,,68,,,张学万/Zhang_Xue_Wan_03.jpg,24969.6
280
+ 111,杜工部丽人行诗意图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_04.jpg,24969.6
281
+ 112,丽人行诗意图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_05.jpg,24969.6
282
+ 113,薛涛吟句,20,张学万,1958,,,Y,国家级,没骨画,68,,68,,,张学万/Zhang_Xue_Wan_06.jpg,12484.8
283
+ 114,丽人行诗意图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_07.jpg,24969.6
284
+ 115,丽人行诗意图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_08.jpg,24969.6
285
+ 116,马球图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_09.jpg,24969.6
286
+ 117,马球图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_10.jpg,24969.6
287
+ 118,游园图,20,张学万,1958,,,Y,国家级,没骨画,68,,68,,,张学万/Zhang_Xue_Wan_11.jpg,12484.8
288
+ 119,唐人马球图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_12.jpg,24969.6
289
+ 120,游春图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_13.jpg,24969.6
290
+ 121,阅稿图,20,张学万,1958,,,Y,国家级,没骨画,68,,100,,,张学万/Zhang_Xue_Wan_14.jpg,18360
291
+ 122,杜工部丽人行诗意图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_15.jpg,24969.6
292
+ 123,雪中情,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_16.jpg,24969.6
293
+ 124,郊游图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_17.jpg,24969.6
294
+ 125,丽人行诗意图,20,张学万,1958,,,Y,国家级,没骨画,98,,198,,,张学万/Zhang_Xue_Wan_18.jpg,52390.8
295
+ 126,马球图,20,张学万,1958,,,Y,国家级,没骨画,98,,178,,,张学万/Zhang_Xue_Wan_19.jpg,47098.8
296
+ 127,踏春图,20,张学万,1958,,,Y,国家级,没骨画,68,,136,,,张学万/Zhang_Xue_Wan_20.jpg,24969.6
297
+ 128,大吉图,20,张学万,1958,,,Y,国家级,没骨画,366,,144,,,张学万/Zhang_Xue_Wan_21.jpg,142300.8
298
+ 129,等待春的颜色,21,赵学超,1974,,,Y,国家级,中国画,120,,138,,,赵学超/Zhao_Xue_Chao_01.jpg,59616
299
+ 130,格桑花的心思,21,赵学超,1974,,,Y,国家级,中国画,100,,100,,,赵学超/Zhao_Xue_Chao_02.jpg,36000
300
+ 131,小憩,21,赵学超,1974,,,Y,国家级,中国画,120,,138,,,赵学超/Zhao_Xue_Chao_03.jpg,59616
301
+ 132,朝圣,21,赵学超,1974,,,Y,国家级,中国画,60,,60,,,赵学超/Zhao_Xue_Chao_04.jpg,12960
302
+ 133,行,21,赵学超,1974,,,Y,国家级,中国画,80,,100,,,赵学超/Zhao_Xue_Chao_05.jpg,28800
303
+ 134,圣山,21,赵学超,1974,,,Y,国家级,中国画,100,,100,,,赵学超/Zhao_Xue_Chao_06.jpg,36000
304
+ 135,卓玛的羊,21,赵学超,1974,,,Y,国家级,中国画,60,,80,,,赵学超/Zhao_Xue_Chao_07.jpg,17280
305
+ 136,牧场,21,赵学超,1974,,,Y,国家级,中国画,80,,100,,,赵学超/Zhao_Xue_Chao_08.jpg,28800
306
+ 137,瞬间,21,赵学超,1974,,,Y,国家级,中国画,80,,100,,,赵学超/Zhao_Xue_Chao_09.jpg,28800
307
+ 138,奔跑,21,赵学超,1974,,,Y,国家级,中国画,120,,120,,,赵学超/Zhao_Xue_Chao_10.jpg,51840
308
+ 139,奔跑的牦牛,21,赵学超,1974,,,Y,国家级,中国画,50,,60,,,赵学超/Zhao_Xue_Chao_11.jpg,10800
309
+ 140,牛气冲天,21,赵学超,1974,,,Y,国家级,中国画,40,,50,,,赵学超/Zhao_Xue_Chao_12.jpg,7200
310
+ 141,藏族肖像,21,赵学超,1974,,,Y,国家级,中国画,40,,40,,,赵学超/Zhao_Xue_Chao_13.jpg,5760
311
+ 142,肖像,21,赵学超,1974,,,Y,国家级,中国画,40,,40,,,赵学超/Zhao_Xue_Chao_14.jpg,5760
312
+ 143,肖像,21,赵学超,1974,,,Y,国家级,中国画,40,,50,,,赵学超/Zhao_Xue_Chao_15.jpg,7200
313
+ 144,麻花辫,21,赵学超,1974,,,Y,国家级,中国画,75,,110,,,赵学超/Zhao_Xue_Chao_16.jpg,29700
314
+ 145,纸鹤故事之一,21,赵学超,1974,,,Y,国家级,中国画,85,,85,,,赵学超/Zhao_Xue_Chao_17.jpg,26010
315
+ 146,放飞的纸鹤,21,赵学超,1974,,,Y,国家级,中国画,100,,100,,,赵学超/Zhao_Xue_Chao_18.jpg,36000
316
+ 147,花儿为谁红,21,赵学超,1974,,,Y,国家级,中国画,60,,80,,,赵学超/Zhao_Xue_Chao_19.jpg,17280
317
+ 148,窗外,21,赵学超,1974,,,Y,国家级,中国画,80,,100,,,赵学超/Zhao_Xue_Chao_20.jpg,28800
318
+ 149,花季,21,赵学超,1974,,,Y,国家级,中国画,80,,100,,,赵学超/Zhao_Xue_Chao_21.jpg,28800
319
+ 150,小萌,21,赵学超,1974,,,Y,国家级,中国画,60,,70,,,赵学超/Zhao_Xue_Chao_22.jpg,15120
datasets/test/README.md ADDED
@@ -0,0 +1 @@
 
1
+ 用于存放测试图片
datasets/train/README.md ADDED
@@ -0,0 +1 @@
 
1
+ 用于存放测试图片
model_data/automl_v2.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0e54abb42887c0e491c22f81be00032ee74479a11476fe0553c4055d30b8290
3
+ size 310939
model_data/cls_classes.txt ADDED
@@ -0,0 +1,2 @@
 
 
1
+ cat
2
+ dog
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ scipy==1.2.1
2
+ numpy==1.17.0
3
+ matplotlib==3.1.2
4
+ tqdm==4.60.0
5
+ Pillow==8.2.0
6
+ h5py==2.10.0
7
+ pandas==1.2.4
8
+ sklearn
9
+ pickle
utils/__init__.py ADDED
@@ -0,0 +1 @@
 
1
+ #
utils/callbacks.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datetime
2
+ import os
3
+
4
+ import torch
5
+ import matplotlib
6
+ matplotlib.use('Agg')
7
+ import scipy.signal
8
+ from matplotlib import pyplot as plt
9
+ from torch.utils.tensorboard import SummaryWriter
10
+
11
+
12
+ class LossHistory():
13
+ def __init__(self, log_dir, model, input_shape):
14
+ time_str = datetime.datetime.strftime(datetime.datetime.now(),'%Y_%m_%d_%H_%M_%S')
15
+ self.log_dir = os.path.join(log_dir, "loss_" + str(time_str))
16
+ self.losses = []
17
+ self.val_loss = []
18
+
19
+ os.makedirs(self.log_dir)
20
+ self.writer = SummaryWriter(self.log_dir)
21
+ try:
22
+ dummy_input = torch.randn(2, 3, input_shape[0], input_shape[1])
23
+ self.writer.add_graph(model, dummy_input)
24
+ except:
25
+ pass
26
+
27
+ def append_loss(self, epoch, loss, val_loss):
28
+ if not os.path.exists(self.log_dir):
29
+ os.makedirs(self.log_dir)
30
+
31
+ self.losses.append(loss)
32
+ self.val_loss.append(val_loss)
33
+
34
+ with open(os.path.join(self.log_dir, "epoch_loss.txt"), 'a') as f:
35
+ f.write(str(loss))
36
+ f.write("\n")
37
+ with open(os.path.join(self.log_dir, "epoch_val_loss.txt"), 'a') as f:
38
+ f.write(str(val_loss))
39
+ f.write("\n")
40
+
41
+ self.writer.add_scalar('loss', loss, epoch)
42
+ self.writer.add_scalar('val_loss', val_loss, epoch)
43
+ self.loss_plot()
44
+
45
+ def loss_plot(self):
46
+ iters = range(len(self.losses))
47
+
48
+ plt.figure()
49
+ plt.plot(iters, self.losses, 'red', linewidth = 2, label='train loss')
50
+ plt.plot(iters, self.val_loss, 'coral', linewidth = 2, label='val loss')
51
+ try:
52
+ if len(self.losses) < 25:
53
+ num = 5
54
+ else:
55
+ num = 15
56
+
57
+ plt.plot(iters, scipy.signal.savgol_filter(self.losses, num, 3), 'green', linestyle = '--', linewidth = 2, label='smooth train loss')
58
+ plt.plot(iters, scipy.signal.savgol_filter(self.val_loss, num, 3), '#8B4513', linestyle = '--', linewidth = 2, label='smooth val loss')
59
+ except:
60
+ pass
61
+
62
+ plt.grid(True)
63
+ plt.xlabel('Epoch')
64
+ plt.ylabel('Loss')
65
+ plt.legend(loc="upper right")
66
+
67
+ plt.savefig(os.path.join(self.log_dir, "epoch_loss.png"))
68
+
69
+ plt.cla()
70
+ plt.close("all")
utils/dataloader.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from matplotlib import artist
2
+ import cv2
3
+ import numpy as np
4
+ import torch
5
+ import torch.utils.data as data
6
+ import pandas as pd
7
+ import os
8
+ from PIL import Image
9
+
10
+ from .utils import cvtColor, preprocess_input
11
+ from .utils_aug import CenterCrop, ImageNetPolicy, RandomResizedCrop, Resize
12
+
13
+
14
+ class DataGenerator(data.Dataset):
15
+ def __init__(self, annotation_lines, input_shape, random=True, autoaugment_flag=True):
16
+ self.artwork_data = annotation_lines
17
+ self.input_shape = input_shape
18
+ self.random = random
19
+ #------------------------------#
20
+ # 是否使用数据增强
21
+ #------------------------------#
22
+ self.autoaugment_flag = autoaugment_flag
23
+ if self.autoaugment_flag:
24
+ self.resize_crop = RandomResizedCrop(input_shape)
25
+ self.policy = ImageNetPolicy()
26
+
27
+ self.resize = Resize(input_shape[0] if input_shape[0] == input_shape[1] else input_shape)
28
+ self.center_crop = CenterCrop(input_shape)
29
+ self.all_features = self.get_all_features(self.artwork_data)
30
+
31
+ def __len__(self):
32
+ return self.artwork_data.shape[0]
33
+
34
+ def __getitem__(self, index):
35
+ # 从数据集中获取图像地址
36
+ annotation_path = self.artwork_data['Duration (s)'][index]
37
+ annotation_path = os.path.join('datasets/archive/Dataset', annotation_path)
38
+ image = Image.open(annotation_path)
39
+ #------------------------------#
40
+ # 读取图像并转换成RGB图像
41
+ #------------------------------#
42
+ image = cvtColor(image)
43
+ if self.autoaugment_flag:
44
+ image = self.AutoAugment(image, random=self.random)
45
+ else:
46
+ image = self.get_random_data(image, self.input_shape, random=self.random)
47
+ # 去除价格特征
48
+ other_features = self.all_features.drop(labels='Prices', axis=1)
49
+ # 取其它特征作为输入
50
+ other_features = other_features.iloc[index].values
51
+ other_features = np.resize(np.array(other_features, dtype=np.float32), self.input_shape)
52
+ other_features = np.expand_dims(other_features, 0)
53
+ image = np.transpose(preprocess_input(np.array(image, dtype=np.float32)), [2, 0, 1])
54
+ all_features = np.concatenate((image, other_features), axis=0)
55
+ # 从数据集中获取价格标签
56
+ y = np.expand_dims(np.array(self.all_features['Prices'][index]), axis=-1)
57
+ return all_features, y
58
+
59
+ def rand(self, a=0, b=1):
60
+ return np.random.rand()*(b-a) + a
61
+
62
+ '''
63
+ @description:
64
+ @param {*} self
65
+ @param {*} all_features
66
+ @return {*} 数据集预处理
67
+ '''
68
+ def get_all_features(self, all_features):
69
+ all_features = all_features.iloc[:, [2,4,5,7,8,9,10,12,16]]
70
+ all_features = all_features.copy()
71
+ numeric_features = all_features.dtypes[all_features.dtypes != 'object'].index
72
+ all_features[numeric_features] = all_features[numeric_features].apply(
73
+ lambda x: (x - x.mean()) / (x.std()))
74
+ # 标准化后,每个特征的均值变为0,所以可以直接用0来替换缺失值
75
+ all_features[numeric_features] = all_features[numeric_features].fillna(0)
76
+ # dummy_na=True将缺失值也当作合法的特征值并为其创建指示特征
77
+ all_features = pd.get_dummies(all_features, dummy_na=True)
78
+ return all_features
79
+
80
+ def get_random_data(self, image, input_shape, jitter=.3, hue=.1, sat=1.5, val=1.5, random=True):
81
+ #------------------------------#
82
+ # 获得图像的高宽与目标高宽
83
+ #------------------------------#
84
+ iw, ih = image.size
85
+ h, w = input_shape
86
+
87
+ if not random:
88
+ scale = min(w/iw, h/ih)
89
+ nw = int(iw*scale)
90
+ nh = int(ih*scale)
91
+ dx = (w-nw)//2
92
+ dy = (h-nh)//2
93
+
94
+ #---------------------------------#
95
+ # 将图像多余的部分加上灰条
96
+ #---------------------------------#
97
+ image = image.resize((nw,nh), Image.BICUBIC)
98
+ new_image = Image.new('RGB', (w,h), (128,128,128))
99
+ new_image.paste(image, (dx, dy))
100
+ image_data = np.array(new_image, np.float32)
101
+
102
+ return image_data
103
+
104
+ #------------------------------------------#
105
+ # 对图像进行缩放并且进行长和宽的扭曲
106
+ #------------------------------------------#
107
+ new_ar = iw/ih * self.rand(1-jitter,1+jitter) / self.rand(1-jitter,1+jitter)
108
+ scale = self.rand(.75, 1.5)
109
+ if new_ar < 1:
110
+ nh = int(scale*h)
111
+ nw = int(nh*new_ar)
112
+ else:
113
+ nw = int(scale*w)
114
+ nh = int(nw/new_ar)
115
+ image = image.resize((nw,nh), Image.BICUBIC)
116
+
117
+ #------------------------------------------#
118
+ # 将图像多余的部分加上灰条
119
+ #------------------------------------------#
120
+ dx = int(self.rand(0, w-nw))
121
+ dy = int(self.rand(0, h-nh))
122
+ new_image = Image.new('RGB', (w,h), (128,128,128))
123
+ new_image.paste(image, (dx, dy))
124
+ image = new_image
125
+
126
+ #------------------------------------------#
127
+ # 翻转图像
128
+ #------------------------------------------#
129
+ flip = self.rand()<.5
130
+ if flip: image = image.transpose(Image.FLIP_LEFT_RIGHT)
131
+
132
+ rotate = self.rand()<.5
133
+ if rotate:
134
+ angle = np.random.randint(-15,15)
135
+ a,b = w/2,h/2
136
+ M = cv2.getRotationMatrix2D((a,b),angle,1)
137
+ image = cv2.warpAffine(np.array(image), M, (w,h), borderValue=[128, 128, 128])
138
+
139
+ image_data = np.array(image, np.uint8)
140
+ #---------------------------------#
141
+ # 对图像进行色域变换
142
+ # 计算色域变换的参数
143
+ #---------------------------------#
144
+ r = np.random.uniform(-1, 1, 3) * [hue, sat, val] + 1
145
+ #---------------------------------#
146
+ # 将图像转到HSV上
147
+ #---------------------------------#
148
+ hue, sat, val = cv2.split(cv2.cvtColor(image_data, cv2.COLOR_RGB2HSV))
149
+ dtype = image_data.dtype
150
+ #---------------------------------#
151
+ # 应用变换
152
+ #---------------------------------#
153
+ x = np.arange(0, 256, dtype=r.dtype)
154
+ lut_hue = ((x * r[0]) % 180).astype(dtype)
155
+ lut_sat = np.clip(x * r[1], 0, 255).astype(dtype)
156
+ lut_val = np.clip(x * r[2], 0, 255).astype(dtype)
157
+
158
+ image_data = cv2.merge((cv2.LUT(hue, lut_hue), cv2.LUT(sat, lut_sat), cv2.LUT(val, lut_val)))
159
+ image_data = cv2.cvtColor(image_data, cv2.COLOR_HSV2RGB)
160
+ return image_data
161
+
162
+ def AutoAugment(self, image, random=True):
163
+ if not random:
164
+ image = self.resize(image)
165
+ image = self.center_crop(image)
166
+ return image
167
+
168
+ #------------------------------------------#
169
+ # resize并且随即裁剪
170
+ #------------------------------------------#
171
+ image = self.resize_crop(image)
172
+
173
+ #------------------------------------------#
174
+ # 翻转图像
175
+ #------------------------------------------#
176
+ flip = self.rand()<.5
177
+ if flip: image = image.transpose(Image.FLIP_LEFT_RIGHT)
178
+
179
+ #------------------------------------------#
180
+ # 随机增强
181
+ #------------------------------------------#
182
+ image = self.policy(image)
183
+ return image
184
+
185
+ def detection_collate(batch):
186
+ images = []
187
+ targets = []
188
+ for image, y in batch:
189
+ images.append(image)
190
+ targets.append(y)
191
+ images = torch.from_numpy(np.array(images)).type(torch.FloatTensor)
192
+ targets = torch.from_numpy(np.array(targets)).type(torch.FloatTensor)
193
+ return images, targets
utils/utils.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import math
2
+ from functools import partial
3
+
4
+ import numpy as np
5
+ import torch
6
+ from PIL import Image
7
+
8
+ from .utils_aug import resize, center_crop
9
+
10
+
11
+ #---------------------------------------------------------#
12
+ # 将图像转换成RGB图像,防止灰度图在预测时报错。
13
+ # 代码仅仅支持RGB图像的预测,所有其它类型的图像都会转化成RGB
14
+ #---------------------------------------------------------#
15
+ def cvtColor(image):
16
+ if len(np.shape(image)) == 3 and np.shape(image)[2] == 3:
17
+ return image
18
+ else:
19
+ image = image.convert('RGB')
20
+ return image
21
+
22
+ #---------------------------------------------------#
23
+ # 对输入图像进行resize
24
+ #---------------------------------------------------#
25
+ def letterbox_image(image, size, letterbox_image):
26
+ w, h = size
27
+ iw, ih = image.size
28
+ if letterbox_image:
29
+ '''resize image with unchanged aspect ratio using padding'''
30
+ scale = min(w/iw, h/ih)
31
+ nw = int(iw*scale)
32
+ nh = int(ih*scale)
33
+
34
+ image = image.resize((nw,nh), Image.BICUBIC)
35
+ new_image = Image.new('RGB', size, (128,128,128))
36
+ new_image.paste(image, ((w-nw)//2, (h-nh)//2))
37
+ else:
38
+ if h == w:
39
+ new_image = resize(image, h)
40
+ else:
41
+ new_image = resize(image, [h ,w])
42
+ new_image = center_crop(new_image, [h ,w])
43
+ return new_image
44
+
45
+ #---------------------------------------------------#
46
+ # 获得类
47
+ #---------------------------------------------------#
48
+ def get_classes(classes_path):
49
+ with open(classes_path, encoding='utf-8') as f:
50
+ class_names = f.readlines()
51
+ class_names = [c.strip() for c in class_names]
52
+ return class_names, len(class_names)
53
+
54
+ #----------------------------------------#
55
+ # 预处理训练图片
56
+ #----------------------------------------#
57
+ def preprocess_input(x):
58
+ x /= 127.5
59
+ x -= 1.
60
+ return x
61
+
62
+ def show_config(**kwargs):
63
+ print('Configurations:')
64
+ print('-' * 70)
65
+ print('|%25s | %40s|' % ('keys', 'values'))
66
+ print('-' * 70)
67
+ for key, value in kwargs.items():
68
+ print('|%25s | %40s|' % (str(key), str(value)))
69
+ print('-' * 70)
70
+
71
+ #---------------------------------------------------#
72
+ # 获得学习率
73
+ #---------------------------------------------------#
74
+ def get_lr(optimizer):
75
+ for param_group in optimizer.param_groups:
76
+ return param_group['lr']
77
+
78
+ def weights_init(net, init_type='normal', init_gain=0.02):
79
+ def init_func(m):
80
+ classname = m.__class__.__name__
81
+ if hasattr(m, 'weight') and classname.find('Conv') != -1:
82
+ if init_type == 'normal':
83
+ torch.nn.init.normal_(m.weight.data, 0.0, init_gain)
84
+ elif init_type == 'xavier':
85
+ torch.nn.init.xavier_normal_(m.weight.data, gain=init_gain)
86
+ elif init_type == 'kaiming':
87
+ torch.nn.init.kaiming_normal_(m.weight.data, a=0, mode='fan_in')
88
+ elif init_type == 'orthogonal':
89
+ torch.nn.init.orthogonal_(m.weight.data, gain=init_gain)
90
+ else:
91
+ raise NotImplementedError('initialization method [%s] is not implemented' % init_type)
92
+ elif classname.find('BatchNorm2d') != -1:
93
+ torch.nn.init.normal_(m.weight.data, 1.0, 0.02)
94
+ torch.nn.init.constant_(m.bias.data, 0.0)
95
+ print('initialize network with %s type' % init_type)
96
+ net.apply(init_func)
97
+
98
+ def get_lr_scheduler(lr_decay_type, lr, min_lr, total_iters, warmup_iters_ratio = 0.05, warmup_lr_ratio = 0.1, no_aug_iter_ratio = 0.05, step_num = 10):
99
+ def yolox_warm_cos_lr(lr, min_lr, total_iters, warmup_total_iters, warmup_lr_start, no_aug_iter, iters):
100
+ if iters <= warmup_total_iters:
101
+ # lr = (lr - warmup_lr_start) * iters / float(warmup_total_iters) + warmup_lr_start
102
+ lr = (lr - warmup_lr_start) * pow(iters / float(warmup_total_iters), 2) + warmup_lr_start
103
+ elif iters >= total_iters - no_aug_iter:
104
+ lr = min_lr
105
+ else:
106
+ lr = min_lr + 0.5 * (lr - min_lr) * (
107
+ 1.0 + math.cos(math.pi* (iters - warmup_total_iters) / (total_iters - warmup_total_iters - no_aug_iter))
108
+ )
109
+ return lr
110
+
111
+ def step_lr(lr, decay_rate, step_size, iters):
112
+ if step_size < 1:
113
+ raise ValueError("step_size must above 1.")
114
+ n = iters // step_size
115
+ out_lr = lr * decay_rate ** n
116
+ return out_lr
117
+
118
+ if lr_decay_type == "cos":
119
+ warmup_total_iters = min(max(warmup_iters_ratio * total_iters, 1), 3)
120
+ warmup_lr_start = max(warmup_lr_ratio * lr, 1e-6)
121
+ no_aug_iter = min(max(no_aug_iter_ratio * total_iters, 1), 15)
122
+ func = partial(yolox_warm_cos_lr ,lr, min_lr, total_iters, warmup_total_iters, warmup_lr_start, no_aug_iter)
123
+ else:
124
+ decay_rate = (min_lr / lr) ** (1 / (step_num - 1))
125
+ step_size = total_iters / step_num
126
+ func = partial(step_lr, lr, decay_rate, step_size)
127
+
128
+ return func
129
+
130
+ def set_optimizer_lr(optimizer, lr_scheduler_func, epoch):
131
+ lr = lr_scheduler_func(epoch)
132
+ for param_group in optimizer.param_groups:
133
+ param_group['lr'] = lr
134
+
135
+ def download_weights(backbone, model_dir="./model_data"):
136
+ import os
137
+ from torch.hub import load_state_dict_from_url
138
+
139
+ download_urls = {
140
+ 'vgg16' : 'https://download.pytorch.org/models/vgg16-397923af.pth',
141
+ 'mobilenet' : 'https://download.pytorch.org/models/mobilenet_v2-b0353104.pth',
142
+ 'resnet50' : 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
143
+ 'vit' : 'https://github.com/bubbliiiing/classification-pytorch/releases/download/v1.0/vit-patch_16.pth'
144
+ }
145
+ url = download_urls[backbone]
146
+
147
+ if not os.path.exists(model_dir):
148
+ os.makedirs(model_dir)
149
+ load_state_dict_from_url(url, model_dir)
utils/utils_aug.py ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numbers
2
+ import random
3
+ import math
4
+ import warnings
5
+ import numpy as np
6
+ from PIL import Image, ImageEnhance, ImageOps
7
+
8
+
9
+ class ShearX(object):
10
+ def __init__(self, fillcolor=(128, 128, 128)):
11
+ self.fillcolor = fillcolor
12
+
13
+ def __call__(self, x, magnitude):
14
+ return x.transform(
15
+ x.size, Image.AFFINE, (1, magnitude * random.choice([-1, 1]), 0, 0, 1, 0),
16
+ Image.BICUBIC, fillcolor=self.fillcolor)
17
+
18
+
19
+ class ShearY(object):
20
+ def __init__(self, fillcolor=(128, 128, 128)):
21
+ self.fillcolor = fillcolor
22
+
23
+ def __call__(self, x, magnitude):
24
+ return x.transform(
25
+ x.size, Image.AFFINE, (1, 0, 0, magnitude * random.choice([-1, 1]), 1, 0),
26
+ Image.BICUBIC, fillcolor=self.fillcolor)
27
+
28
+
29
+ class TranslateX(object):
30
+ def __init__(self, fillcolor=(128, 128, 128)):
31
+ self.fillcolor = fillcolor
32
+
33
+ def __call__(self, x, magnitude):
34
+ return x.transform(
35
+ x.size, Image.AFFINE, (1, 0, magnitude * x.size[0] * random.choice([-1, 1]), 0, 1, 0),
36
+ fillcolor=self.fillcolor)
37
+
38
+
39
+ class TranslateY(object):
40
+ def __init__(self, fillcolor=(128, 128, 128)):
41
+ self.fillcolor = fillcolor
42
+
43
+ def __call__(self, x, magnitude):
44
+ return x.transform(
45
+ x.size, Image.AFFINE, (1, 0, 0, 0, 1, magnitude * x.size[1] * random.choice([-1, 1])),
46
+ fillcolor=self.fillcolor)
47
+
48
+
49
+ class Rotate(object):
50
+ # from https://stackoverflow.com/questions/
51
+ # 5252170/specify-image-filling-color-when-rotating-in-python-with-pil-and-setting-expand
52
+ def __call__(self, x, magnitude):
53
+ rot = x.convert("RGBA").rotate(magnitude * random.choice([-1, 1]))
54
+ return Image.composite(rot, Image.new("RGBA", rot.size, (128,) * 4), rot).convert(x.mode)
55
+
56
+
57
+ class Color(object):
58
+ def __call__(self, x, magnitude):
59
+ return ImageEnhance.Color(x).enhance(1 + magnitude * random.choice([-1, 1]))
60
+
61
+
62
+ class Posterize(object):
63
+ def __call__(self, x, magnitude):
64
+ return ImageOps.posterize(x, magnitude)
65
+
66
+
67
+ class Solarize(object):
68
+ def __call__(self, x, magnitude):
69
+ return ImageOps.solarize(x, magnitude)
70
+
71
+
72
+ class Contrast(object):
73
+ def __call__(self, x, magnitude):
74
+ return ImageEnhance.Contrast(x).enhance(1 + magnitude * random.choice([-1, 1]))
75
+
76
+
77
+ class Sharpness(object):
78
+ def __call__(self, x, magnitude):
79
+ return ImageEnhance.Sharpness(x).enhance(1 + magnitude * random.choice([-1, 1]))
80
+
81
+
82
+ class Brightness(object):
83
+ def __call__(self, x, magnitude):
84
+ return ImageEnhance.Brightness(x).enhance(1 + magnitude * random.choice([-1, 1]))
85
+
86
+
87
+ class AutoContrast(object):
88
+ def __call__(self, x, magnitude):
89
+ return ImageOps.autocontrast(x)
90
+
91
+
92
+ class Equalize(object):
93
+ def __call__(self, x, magnitude):
94
+ return ImageOps.equalize(x)
95
+
96
+
97
+ class Invert(object):
98
+ def __call__(self, x, magnitude):
99
+ return ImageOps.invert(x)
100
+
101
+
102
+ class ImageNetPolicy(object):
103
+ """ Randomly choose one of the best 24 Sub-policies on ImageNet.
104
+ Example:
105
+ >>> policy = ImageNetPolicy()
106
+ >>> transformed = policy(image)
107
+ Example as a PyTorch Transform:
108
+ >>> transform = transforms.Compose([
109
+ >>> transforms.Resize(256),
110
+ >>> ImageNetPolicy(),
111
+ >>> transforms.ToTensor()])
112
+ """
113
+ def __init__(self, fillcolor=(128, 128, 128)):
114
+ self.policies = [
115
+ SubPolicy(0.4, "posterize", 8, 0.6, "rotate", 9, fillcolor),
116
+ SubPolicy(0.6, "solarize", 5, 0.6, "autocontrast", 5, fillcolor),
117
+ SubPolicy(0.8, "equalize", 8, 0.6, "equalize", 3, fillcolor),
118
+ SubPolicy(0.6, "posterize", 7, 0.6, "posterize", 6, fillcolor),
119
+ SubPolicy(0.4, "equalize", 7, 0.2, "solarize", 4, fillcolor),
120
+
121
+ SubPolicy(0.4, "equalize", 4, 0.8, "rotate", 8, fillcolor),
122
+ SubPolicy(0.6, "solarize", 3, 0.6, "equalize", 7, fillcolor),
123
+ SubPolicy(0.8, "posterize", 5, 1.0, "equalize", 2, fillcolor),
124
+ SubPolicy(0.2, "rotate", 3, 0.6, "solarize", 8, fillcolor),
125
+ SubPolicy(0.6, "equalize", 8, 0.4, "posterize", 6, fillcolor),
126
+
127
+ SubPolicy(0.8, "rotate", 8, 0.4, "color", 0, fillcolor),
128
+ SubPolicy(0.4, "rotate", 9, 0.6, "equalize", 2, fillcolor),
129
+ SubPolicy(0.0, "equalize", 7, 0.8, "equalize", 8, fillcolor),
130
+ SubPolicy(0.6, "invert", 4, 1.0, "equalize", 8, fillcolor),
131
+ SubPolicy(0.6, "color", 4, 1.0, "contrast", 8, fillcolor),
132
+
133
+ SubPolicy(0.8, "rotate", 8, 1.0, "color", 2, fillcolor),
134
+ SubPolicy(0.8, "color", 8, 0.8, "solarize", 7, fillcolor),
135
+ SubPolicy(0.4, "sharpness", 7, 0.6, "invert", 8, fillcolor),
136
+ SubPolicy(0.6, "shearX", 5, 1.0, "equalize", 9, fillcolor),
137
+ SubPolicy(0.4, "color", 0, 0.6, "equalize", 3, fillcolor),
138
+
139
+ SubPolicy(0.4, "equalize", 7, 0.2, "solarize", 4, fillcolor),
140
+ SubPolicy(0.6, "solarize", 5, 0.6, "autocontrast", 5, fillcolor),
141
+ SubPolicy(0.6, "invert", 4, 1.0, "equalize", 8, fillcolor),
142
+ SubPolicy(0.6, "color", 4, 1.0, "contrast", 8, fillcolor),
143
+ SubPolicy(0.8, "equalize", 8, 0.6, "equalize", 3, fillcolor)
144
+ ]
145
+
146
+ def __call__(self, img):
147
+ policy_idx = random.randint(0, len(self.policies) - 1)
148
+ return self.policies[policy_idx](img)
149
+
150
+ def __repr__(self):
151
+ return "AutoAugment ImageNet Policy"
152
+
153
+ class SubPolicy(object):
154
+ def __init__(self, p1, operation1, magnitude_idx1, p2, operation2, magnitude_idx2, fillcolor=(128, 128, 128)):
155
+ ranges = {
156
+ "shearX": np.linspace(0, 0.3, 10),
157
+ "shearY": np.linspace(0, 0.3, 10),
158
+ "translateX": np.linspace(0, 150 / 331, 10),
159
+ "translateY": np.linspace(0, 150 / 331, 10),
160
+ "rotate": np.linspace(0, 30, 10),
161
+ "color": np.linspace(0.0, 0.9, 10),
162
+ "posterize": np.round(np.linspace(8, 4, 10), 0).astype(np.int),
163
+ "solarize": np.linspace(256, 0, 10),
164
+ "contrast": np.linspace(0.0, 0.9, 10),
165
+ "sharpness": np.linspace(0.0, 0.9, 10),
166
+ "brightness": np.linspace(0.0, 0.9, 10),
167
+ "autocontrast": [0] * 10,
168
+ "equalize": [0] * 10,
169
+ "invert": [0] * 10
170
+ }
171
+
172
+ func = {
173
+ "shearX": ShearX(fillcolor=fillcolor),
174
+ "shearY": ShearY(fillcolor=fillcolor),
175
+ "translateX": TranslateX(fillcolor=fillcolor),
176
+ "translateY": TranslateY(fillcolor=fillcolor),
177
+ "rotate": Rotate(),
178
+ "color": Color(),
179
+ "posterize": Posterize(),
180
+ "solarize": Solarize(),
181
+ "contrast": Contrast(),
182
+ "sharpness": Sharpness(),
183
+ "brightness": Brightness(),
184
+ "autocontrast": AutoContrast(),
185
+ "equalize": Equalize(),
186
+ "invert": Invert()
187
+ }
188
+
189
+ self.p1 = p1
190
+ self.operation1 = func[operation1]
191
+ self.magnitude1 = ranges[operation1][magnitude_idx1]
192
+ self.p2 = p2
193
+ self.operation2 = func[operation2]
194
+ self.magnitude2 = ranges[operation2][magnitude_idx2]
195
+
196
+ def __call__(self, img):
197
+ if random.random() < self.p1:
198
+ img = self.operation1(img, self.magnitude1)
199
+ if random.random() < self.p2:
200
+ img = self.operation2(img, self.magnitude2)
201
+ return img
202
+
203
+ def crop(img, i, j, h, w):
204
+ """Crop the given PIL Image.
205
+
206
+ Args:
207
+ img (PIL Image): Image to be cropped.
208
+ i (int): i in (i,j) i.e coordinates of the upper left corner.
209
+ j (int): j in (i,j) i.e coordinates of the upper left corner.
210
+ h (int): Height of the cropped image.
211
+ w (int): Width of the cropped image.
212
+
213
+ Returns:
214
+ PIL Image: Cropped image.
215
+ """
216
+ return img.crop((j, i, j + w, i + h))
217
+
218
+ def resize(img, size, interpolation=Image.BILINEAR):
219
+ r"""Resize the input PIL Image to the given size.
220
+
221
+ Args:
222
+ img (PIL Image): Image to be resized.
223
+ size (sequence or int): Desired output size. If size is a sequence like
224
+ (h, w), the output size will be matched to this. If size is an int,
225
+ the smaller edge of the image will be matched to this number maintaing
226
+ the aspect ratio. i.e, if height > width, then image will be rescaled to
227
+ :math:`\left(\text{size} \times \frac{\text{height}}{\text{width}}, \text{size}\right)`
228
+ interpolation (int, optional): Desired interpolation. Default is
229
+ ``PIL.Image.BILINEAR``
230
+
231
+ Returns:
232
+ PIL Image: Resized image.
233
+ """
234
+ if isinstance(size, int):
235
+ w, h = img.size
236
+ if (w <= h and w == size) or (h <= w and h == size):
237
+ return img
238
+ if w < h:
239
+ ow = size
240
+ oh = int(size * h / w)
241
+ return img.resize((ow, oh), interpolation)
242
+ else:
243
+ oh = size
244
+ ow = int(size * w / h)
245
+ return img.resize((ow, oh), interpolation)
246
+ else:
247
+ return img.resize(size[::-1], interpolation)
248
+
249
+ def center_crop(img, output_size):
250
+ if isinstance(output_size, numbers.Number):
251
+ output_size = (int(output_size), int(output_size))
252
+ w, h = img.size
253
+ th, tw = output_size
254
+ i = int(round((h - th) / 2.))
255
+ j = int(round((w - tw) / 2.))
256
+ return crop(img, i, j, th, tw)
257
+
258
+ def resized_crop(img, i, j, h, w, size, interpolation=Image.BILINEAR):
259
+ """Crop the given PIL Image and resize it to desired size.
260
+
261
+ Notably used in :class:`~torchvision.transforms.RandomResizedCrop`.
262
+
263
+ Args:
264
+ img (PIL Image): Image to be cropped.
265
+ i (int): i in (i,j) i.e coordinates of the upper left corner
266
+ j (int): j in (i,j) i.e coordinates of the upper left corner
267
+ h (int): Height of the cropped image.
268
+ w (int): Width of the cropped image.
269
+ size (sequence or int): Desired output size. Same semantics as ``resize``.
270
+ interpolation (int, optional): Desired interpolation. Default is
271
+ ``PIL.Image.BILINEAR``.
272
+ Returns:
273
+ PIL Image: Cropped image.
274
+ """
275
+ img = crop(img, i, j, h, w)
276
+ img = resize(img, size, interpolation)
277
+ return img
278
+
279
+ class Resize(object):
280
+ """Resize the input PIL Image to the given size.
281
+
282
+ Args:
283
+ size (sequence or int): Desired output size. If size is a sequence like
284
+ (h, w), output size will be matched to this. If size is an int,
285
+ smaller edge of the image will be matched to this number.
286
+ i.e, if height > width, then image will be rescaled to
287
+ (size * height / width, size)
288
+ interpolation (int, optional): Desired interpolation. Default is
289
+ ``PIL.Image.BILINEAR``
290
+ """
291
+
292
+ def __init__(self, size, interpolation=Image.BILINEAR):
293
+ self.size = size
294
+ self.interpolation = interpolation
295
+
296
+ def __call__(self, img):
297
+ """
298
+ Args:
299
+ img (PIL Image): Image to be scaled.
300
+
301
+ Returns:
302
+ PIL Image: Rescaled image.
303
+ """
304
+ return resize(img, self.size, self.interpolation)
305
+
306
+ class CenterCrop(object):
307
+ """Crops the given PIL Image at the center.
308
+
309
+ Args:
310
+ size (sequence or int): Desired output size of the crop. If size is an
311
+ int instead of sequence like (h, w), a square crop (size, size) is
312
+ made.
313
+ """
314
+
315
+ def __init__(self, size):
316
+ self.size = size
317
+
318
+ def __call__(self, img):
319
+ """
320
+ Args:
321
+ img (PIL Image): Image to be cropped.
322
+
323
+ Returns:
324
+ PIL Image: Cropped image.
325
+ """
326
+ return center_crop(img, self.size)
327
+
328
+ class RandomResizedCrop(object):
329
+ """Crop the given PIL Image to random size and aspect ratio.
330
+
331
+ A crop of random size (default: of 0.08 to 1.0) of the original size and a random
332
+ aspect ratio (default: of 3/4 to 4/3) of the original aspect ratio is made. This crop
333
+ is finally resized to given size.
334
+ This is popularly used to train the Inception networks.
335
+
336
+ Args:
337
+ size: expected output size of each edge
338
+ scale: range of size of the origin size cropped
339
+ ratio: range of aspect ratio of the origin aspect ratio cropped
340
+ interpolation: Default: PIL.Image.BILINEAR
341
+ """
342
+
343
+ def __init__(self, size, scale=(0.08, 1.0), ratio=(3. / 4., 4. / 3.), interpolation=Image.BILINEAR):
344
+ self.size = size
345
+ if (scale[0] > scale[1]) or (ratio[0] > ratio[1]):
346
+ warnings.warn("range should be of kind (min, max)")
347
+
348
+ self.interpolation = interpolation
349
+ self.scale = scale
350
+ self.ratio = ratio
351
+
352
+ @staticmethod
353
+ def get_params(img, scale, ratio):
354
+ """Get parameters for ``crop`` for a random sized crop.
355
+
356
+ Args:
357
+ img (PIL Image): Image to be cropped.
358
+ scale (tuple): range of size of the origin size cropped
359
+ ratio (tuple): range of aspect ratio of the origin aspect ratio cropped
360
+
361
+ Returns:
362
+ tuple: params (i, j, h, w) to be passed to ``crop`` for a random
363
+ sized crop.
364
+ """
365
+ area = img.size[0] * img.size[1]
366
+
367
+ for attempt in range(10):
368
+ target_area = random.uniform(*scale) * area
369
+ log_ratio = (math.log(ratio[0]), math.log(ratio[1]))
370
+ aspect_ratio = math.exp(random.uniform(*log_ratio))
371
+
372
+ w = int(round(math.sqrt(target_area * aspect_ratio)))
373
+ h = int(round(math.sqrt(target_area / aspect_ratio)))
374
+
375
+ if w <= img.size[0] and h <= img.size[1]:
376
+ i = random.randint(0, img.size[1] - h)
377
+ j = random.randint(0, img.size[0] - w)
378
+ return i, j, h, w
379
+
380
+ # Fallback to central crop
381
+ in_ratio = img.size[0] / img.size[1]
382
+ if (in_ratio < min(ratio)):
383
+ w = img.size[0]
384
+ h = int(round(w / min(ratio)))
385
+ elif (in_ratio > max(ratio)):
386
+ h = img.size[1]
387
+ w = int(round(h * max(ratio)))
388
+ else: # whole image
389
+ w = img.size[0]
390
+ h = img.size[1]
391
+ i = (img.size[1] - h) // 2
392
+ j = (img.size[0] - w) // 2
393
+ return i, j, h, w
394
+
395
+ def __call__(self, img):
396
+ """
397
+ Args:
398
+ img (PIL Image): Image to be cropped and resized.
399
+
400
+ Returns:
401
+ PIL Image: Randomly cropped and resized image.
402
+ """
403
+ i, j, h, w = self.get_params(img, self.scale, self.ratio)
404
+ return resized_crop(img, i, j, h, w, self.size, self.interpolation)
utils/utils_fit.py ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from threading import local
3
+
4
+ import torch
5
+ import torch.nn.functional as F
6
+ from torch import nn
7
+ from tqdm import tqdm
8
+
9
+ from .utils import get_lr
10
+
11
+ def log_rmse(outputs, labels, loss):
12
+ with torch.no_grad():
13
+ # 将小于1的值设成1,使得取对数时数值更稳定
14
+ clipped_preds = torch.max(outputs, torch.tensor(1.0))
15
+ rmse = torch.sqrt(2 * loss(clipped_preds.log(), labels.log()).mean())
16
+ return rmse
17
+
18
+ def fit_one_epoch(model_train, model, loss_history, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, Epoch, cuda, fp16, scaler, save_period, save_dir, local_rank=0):
19
+ total_loss = 0
20
+ total_rmse = 0
21
+
22
+ val_loss = 0
23
+ val_rmse = 0
24
+ # 定义损失函数
25
+ loss = nn.MSELoss()
26
+ if local_rank == 0:
27
+ print('Start Train')
28
+ pbar = tqdm(total=epoch_step,desc=f'Epoch {epoch + 1}/{Epoch}',postfix=dict,mininterval=0.3)
29
+ model_train.train()
30
+ for iteration, batch in enumerate(gen):
31
+ if iteration >= epoch_step:
32
+ break
33
+ images, targets = batch
34
+ with torch.no_grad():
35
+ if cuda:
36
+ images = images.cuda(local_rank)
37
+ targets = targets.cuda(local_rank)
38
+
39
+ #----------------------#
40
+ # 清零梯度
41
+ #----------------------#
42
+ optimizer.zero_grad()
43
+ if not fp16:
44
+ #----------------------#
45
+ # 前向传播
46
+ #----------------------#
47
+ outputs = model_train(images)
48
+ #----------------------#
49
+ # 计算损失
50
+ #----------------------#
51
+ loss_value = loss(outputs, targets)
52
+ loss_value.backward()
53
+ optimizer.step()
54
+ else:
55
+ from torch.cuda.amp import autocast
56
+ with autocast():
57
+ #----------------------#
58
+ # 前向传播
59
+ #----------------------#
60
+ outputs = model_train(images)
61
+ #----------------------#
62
+ # 计算损失
63
+ #----------------------#
64
+ loss_value = loss(outputs, targets)
65
+ #----------------------#
66
+ # 反向传播
67
+ #----------------------#
68
+ scaler.scale(loss_value).backward()
69
+ scaler.step(optimizer)
70
+ scaler.update()
71
+
72
+ total_loss += loss_value.item()
73
+ # 计算对数均方根误差
74
+ with torch.no_grad():
75
+ rmse = log_rmse(outputs, targets, loss)
76
+ total_rmse += rmse.item()
77
+
78
+ if local_rank == 0:
79
+ pbar.set_postfix(**{'total_loss': total_loss / (iteration + 1),
80
+ 'total_rmse': total_rmse / (iteration + 1),
81
+ 'lr' : get_lr(optimizer)})
82
+ pbar.update(1)
83
+
84
+ if local_rank == 0:
85
+ pbar.close()
86
+ print('Finish Train')
87
+ print('Start Validation')
88
+ pbar = tqdm(total=epoch_step_val, desc=f'Epoch {epoch + 1}/{Epoch}',postfix=dict,mininterval=0.3)
89
+ model_train.eval()
90
+ for iteration, batch in enumerate(gen_val):
91
+ if iteration >= epoch_step_val:
92
+ break
93
+ images, targets = batch
94
+ with torch.no_grad():
95
+ if cuda:
96
+ images = images.cuda(local_rank)
97
+ targets = targets.cuda(local_rank)
98
+
99
+ optimizer.zero_grad()
100
+
101
+ outputs = model_train(images)
102
+ loss_value = loss(outputs, targets)
103
+
104
+ val_loss += loss_value.item()
105
+ rmse = log_rmse(outputs, targets, loss)
106
+ val_rmse += rmse.item()
107
+
108
+ if local_rank == 0:
109
+ pbar.set_postfix(**{'total_loss': val_loss / (iteration + 1),
110
+ 'total_rmse': val_rmse / (iteration + 1),
111
+ 'lr' : get_lr(optimizer)})
112
+ pbar.update(1)
113
+
114
+ if local_rank == 0:
115
+ pbar.close()
116
+ print('Finish Validation')
117
+ loss_history.append_loss(epoch + 1, total_loss / epoch_step, val_loss / epoch_step_val)
118
+ print('Epoch:' + str(epoch + 1) + '/' + str(Epoch))
119
+ print('Total Loss: %.3f || Val Loss: %.3f ' % (total_loss / epoch_step, val_loss / epoch_step_val))
120
+
121
+ #-----------------------------------------------#
122
+ # 保存权值
123
+ #-----------------------------------------------#
124
+ if (epoch + 1) % save_period == 0 or epoch + 1 == Epoch:
125
+ torch.save(model.state_dict(), os.path.join(save_dir, "ep%03d-loss%.3f-val_loss%.3f.pth" % (epoch + 1, total_loss / epoch_step, val_loss / epoch_step_val)))
126
+
127
+ if len(loss_history.val_loss) <= 1 or (val_loss / epoch_step_val) <= min(loss_history.val_loss):
128
+ print('Save best model to best_epoch_weights.pth')
129
+ torch.save(model.state_dict(), os.path.join(save_dir, "best_epoch_weights.pth"))
130
+
131
+ torch.save(model.state_dict(), os.path.join(save_dir, "last_epoch_weights.pth"))
utils/utils_metrics.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import os
3
+
4
+ import matplotlib.pyplot as plt
5
+ import numpy as np
6
+ from PIL import Image
7
+
8
+ def evaluteTop1_5(classfication, lines, metrics_out_path):
9
+ correct_1 = 0
10
+ correct_5 = 0
11
+ preds = []
12
+ labels = []
13
+ total = len(lines)
14
+ for index, line in enumerate(lines):
15
+ annotation_path = line.split(';')[1].split()[0]
16
+ x = Image.open(annotation_path)
17
+ y = int(line.split(';')[0])
18
+
19
+ pred = classfication.detect_image(x)
20
+ pred_1 = np.argmax(pred)
21
+ correct_1 += pred_1 == y
22
+
23
+ pred_5 = np.argsort(pred)[::-1]
24
+ pred_5 = pred_5[:5]
25
+ correct_5 += y in pred_5
26
+
27
+ preds.append(pred_1)
28
+ labels.append(y)
29
+ if index % 100 == 0:
30
+ print("[%d/%d]"%(index, total))
31
+
32
+ hist = fast_hist(np.array(labels), np.array(preds), len(classfication.class_names))
33
+ Recall = per_class_Recall(hist)
34
+ Precision = per_class_Precision(hist)
35
+
36
+ show_results(metrics_out_path, hist, Recall, Precision, classfication.class_names)
37
+ return correct_1 / total, correct_5 / total, Recall, Precision
38
+
39
+ def fast_hist(a, b, n):
40
+ k = (a >= 0) & (a < n)
41
+ return np.bincount(n * a[k].astype(int) + b[k], minlength=n ** 2).reshape(n, n)
42
+
43
+ def per_class_Recall(hist):
44
+ return np.diag(hist) / np.maximum(hist.sum(1), 1)
45
+
46
+ def per_class_Precision(hist):
47
+ return np.diag(hist) / np.maximum(hist.sum(0), 1)
48
+
49
+ def adjust_axes(r, t, fig, axes):
50
+ bb = t.get_window_extent(renderer=r)
51
+ text_width_inches = bb.width / fig.dpi
52
+ current_fig_width = fig.get_figwidth()
53
+ new_fig_width = current_fig_width + text_width_inches
54
+ propotion = new_fig_width / current_fig_width
55
+ x_lim = axes.get_xlim()
56
+ axes.set_xlim([x_lim[0], x_lim[1] * propotion])
57
+
58
+ def draw_plot_func(values, name_classes, plot_title, x_label, output_path, tick_font_size = 12, plt_show = True):
59
+ fig = plt.gcf()
60
+ axes = plt.gca()
61
+ plt.barh(range(len(values)), values, color='royalblue')
62
+ plt.title(plot_title, fontsize=tick_font_size + 2)
63
+ plt.xlabel(x_label, fontsize=tick_font_size)
64
+ plt.yticks(range(len(values)), name_classes, fontsize=tick_font_size)
65
+ r = fig.canvas.get_renderer()
66
+ for i, val in enumerate(values):
67
+ str_val = " " + str(val)
68
+ if val < 1.0:
69
+ str_val = " {0:.2f}".format(val)
70
+ t = plt.text(val, i, str_val, color='royalblue', va='center', fontweight='bold')
71
+ if i == (len(values)-1):
72
+ adjust_axes(r, t, fig, axes)
73
+
74
+ fig.tight_layout()
75
+ fig.savefig(output_path)
76
+ if plt_show:
77
+ plt.show()
78
+ plt.close()
79
+
80
+ def show_results(miou_out_path, hist, Recall, Precision, name_classes, tick_font_size = 12):
81
+ draw_plot_func(Recall, name_classes, "mRecall = {0:.2f}%".format(np.nanmean(Recall)*100), "Recall", \
82
+ os.path.join(miou_out_path, "Recall.png"), tick_font_size = tick_font_size, plt_show = False)
83
+ print("Save Recall out to " + os.path.join(miou_out_path, "Recall.png"))
84
+
85
+ draw_plot_func(Precision, name_classes, "mPrecision = {0:.2f}%".format(np.nanmean(Precision)*100), "Precision", \
86
+ os.path.join(miou_out_path, "Precision.png"), tick_font_size = tick_font_size, plt_show = False)
87
+ print("Save Precision out to " + os.path.join(miou_out_path, "Precision.png"))
88
+
89
+ with open(os.path.join(miou_out_path, "confusion_matrix.csv"), 'w', newline='') as f:
90
+ writer = csv.writer(f)
91
+ writer_list = []
92
+ writer_list.append([' '] + [str(c) for c in name_classes])
93
+ for i in range(len(hist)):
94
+ writer_list.append([name_classes[i]] + [str(x) for x in hist[i]])
95
+ writer.writerows(writer_list)
96
+ print("Save confusion_matrix out to " + os.path.join(miou_out_path, "confusion_matrix.csv"))
97
+
98
+ def evaluteRecall(classfication, lines, metrics_out_path):
99
+ correct = 0
100
+ total = len(lines)
101
+
102
+ preds = []
103
+ labels = []
104
+ for index, line in enumerate(lines):
105
+ annotation_path = line.split(';')[1].split()[0]
106
+ x = Image.open(annotation_path)
107
+ y = int(line.split(';')[0])
108
+
109
+ pred = classfication.detect_image(x)
110
+ pred = np.argmax(pred)
111
+
112
+ preds.append(pred)
113
+ labels.append(y)
114
+
115
+ hist = fast_hist(labels, preds, len(classfication.class_names))
116
+ Recall = per_class_Recall(hist)
117
+ Precision = per_class_Precision(hist)
118
+
119
+ show_results(metrics_out_path, hist, Recall, Precision, classfication.class_names)
120
+ return correct / total