mirror of
https://github.com/NanjingForestryUniversity/supermachine-tobacco.git
synced 2025-11-08 22:33:54 +00:00
采了新数据
This commit is contained in:
parent
0f5c8dae17
commit
be54646190
262
01_dataset.ipynb
262
01_dataset.ipynb
File diff suppressed because one or more lines are too long
@ -13,7 +13,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
@ -94,7 +94,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
@ -107,12 +107,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"metadata": {
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
},
|
||||
"execution_count": 3,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@ -133,11 +128,29 @@
|
||||
"source": [
|
||||
"# model.fit(x, world_boundary, threshold, negative_sample_size=negative_sample_num, train_size=0.7,\n",
|
||||
"# is_save_dataset=True, model_selection='dt')\n",
|
||||
"data = scipy.io.loadmat('data/dataset/dataset_2022-07-19_17-06.mat')\n",
|
||||
"data = scipy.io.loadmat('data/dataset/dataset_2022-07-20_10-04.mat')\n",
|
||||
"x, y = data['x'], data['y'].ravel()\n",
|
||||
"model.fit(x, y=y, is_generate_negative=False, model_selection='dt')\n",
|
||||
"model.save()"
|
||||
]
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
16
main_test.py
16
main_test.py
@ -31,7 +31,7 @@ def virtual_main(detector: Detector, test_img=None, test_img_dir=None, test_mode
|
||||
else:
|
||||
raise TypeError("test img should be np.ndarray or str")
|
||||
t1 = time.time()
|
||||
# img = cv2.resize(img, (1024, 256))
|
||||
img = cv2.resize(img, (1024, 256))
|
||||
t2 = time.time()
|
||||
result = 1 - detector.predict(img)
|
||||
t3 = time.time()
|
||||
@ -55,7 +55,13 @@ def virtual_main(detector: Detector, test_img=None, test_img_dir=None, test_mode
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
detector = AnonymousColorDetector(file_path='dt_2022-07-19_17-07.model')
|
||||
virtual_main(detector, test_img=r'data/dataset/img/yangeng.bmp', test_model=True)
|
||||
virtual_main(detector, test_img=r'data/dataset/img/yangeng.bmp', test_model=True)
|
||||
virtual_main(detector, test_img=r'data/dataset/img/yangeng.bmp', test_model=True)
|
||||
detector = AnonymousColorDetector(file_path='dt_2022-07-20_14-40.model')
|
||||
virtual_main(detector,
|
||||
test_img=r'C:\Users\FEIJINTI\Desktop\720\binning1\tobacco\Image_2022_0720_1354_46_472-003051.bmp',
|
||||
test_model=True)
|
||||
virtual_main(detector,
|
||||
test_img=r'C:\Users\FEIJINTI\Desktop\720\binning1\tobacco\Image_2022_0720_1354_46_472-003051.bmp',
|
||||
test_model=True)
|
||||
virtual_main(detector,
|
||||
test_img=r'C:\Users\FEIJINTI\Desktop\720\binning1\tobacco\Image_2022_0720_1354_46_472-003051.bmp',
|
||||
test_model=True)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user