几个月前做的项目,整理一下,比较简单,就是根据数据集进行图片分类(使用resnet50),再通过识别结果匹配推荐数据库,进行推荐。
前端:html、js
后端:python-flask框架、pytorch框架
项目结构:
dataset_dir文件夹:数据集放进这个文件夹,不同种类图片放进对应种类文件夹,再通过
models文件夹:存放训练好的模型
static文件夹:存放前端网页显示的需要的图片
templates文件夹:前端网页模板文件
inference.py 测试推理效果的文件
label.py
- from torchvision.datasets import ImageFolder
-
- dataset=ImageFolder("C:/Users/forwhat/Desktop/recommend/cloth/train") #获取路径,返回的是所有图的data、label
- print(dataset.class_to_idx) #查看类别名,及对应的标签。
- print(dataset.imgs) #查看路径里所有的图片,及对应的标签
label_level2.py
- under_jeans =['https://detail.tmall.com/item.htm?id=636464038643','https://detail.tmall.com/item.htm?id=629142114736','https://item.taobao.com/item.htm?id=633482107680','https://item.taobao.com/item.htm?id=653135699650'
- ,'https://detail.tmall.com/item.htm?id=626092831491']
- under_skirt = ['https://item.taobao.com/item.htm?id=667268983604','https://detail.tmall.com/item.htm?id=668100149427','https://detail.tmall.com/item.htm?id=586698989166','https://detail.tmall.com/item.htm?id=635332780625'
- ,'https://detail.tmall.com/item.htm?id=637917736279']
- under_sporty = ['https://detail.tmall.com/item.htm?id=613077657236','https://detail.tmall.com/item.htm?id=580354266231','https://detail.tmall.com/item.htm?id=580354266231','https://detail.tmall.com/item.htm?id=653363447356','https://item.taobao.com/item.htm?id=579123847078'
- ,'https://detail.tmall.com/item.htm?id=42730275588']
- under_suit = ['https://detail.tmall.com/item.htm?id=618731089852','https://detail.tmall.com/item.htm?id=618596933879','https://detail.tmall.com/item.htm?id=636256949983','https://detail.tmall.com/item.htm?id=636363512038'
- ,'https://item.taobao.com/item.htm?id=665038582357']
- upper_casual = ['https://detail.tmall.com/item.htm?id=666855488772','https://detail.tmall.com/item.htm?id=667962767730','https://detail.tmall.com/item.htm?id=610974657070','https://detail.tmall.com/item.htm?id=645567560209'
- ,'https://detail.tmall.com/item.htm?id=644415535799']
- upper_coat = ['https://item.taobao.com/item.htm?id=552053460493','https://item.taobao.com/item.htm?id=598306760200','https://detail.tmall.com/item.htm?id=665519667811','https://detail.tmall.com/item.htm?id=585993479022'
- ,'https://item.taobao.com/item.htm?id=649233831246']
- upper_hoodie = ['https://detail.tmall.com/item.htm?id=666165898023','https://item.taobao.com/item.htm?id=652872409153','https://item.taobao.com/item.htm?id=628894958150','https://detail.tmall.com/item.htm?id=633528937891'
- ,'https://item.taobao.com/item.htm?id=656080489764']
- upper_sporty = ['https://item.taobao.com/item.htm?id=628559051772','https://detail.tmall.com/item.htm?id=668803933152','https://detail.tmall.com/item.htm?id=655672026380','https://detail.tmall.com/item.htm?id=631357306618'
- ,'https://detail.tmall.com/item.htm?id=601009441405']
- upper_suit = ['https://detail.tmall.com/item.htm?id=666236552324','https://detail.tmall.com/item.htm?id=668803933152','https://item.taobao.com/item.htm?id=625828294674','https://detail.tmall.com/item.htm?id=649272374842','https://detail.tmall.com/item.htm?id=666063758350'
- ,'https://item.taobao.com/item.htm?id=668250478482']
- whole_dress = ['https://detail.tmall.com/item.htm?id=598268797504','https://item.taobao.com/item.htm?id=666364831194','https://detail.tmall.com/item.htm?id=667095587171','https://detail.tmall.com/item.htm?id=642013218199'
- ,'https://detail.tmall.com/item.htm?id=669133765583']
split_dataset.py脚本对数据集进行训练集、验证集、测试集的划分。
train.py脚本对数据集进行训练
数据集
符合格式就可以,参考链接一
效果展示
点击一个链接看看
开源地址
基于神经网络的简单推荐系统: 几个月前做的项目,整理一下,比较简单,就是根据数据集进行图片分类(使用resnet50),再通过识别结果匹配推荐数据库,进行推荐。 (gitee.com)
参考资料
(195条消息) 【深度学习】使用python划分数据集为训练集和验证集和测试集并放在不同的文件夹_我系渣渣的博客-CSDN博客_python划分数据集为训练集和测试集