diff --git a/backend/applications/image_processing/render.py b/backend/applications/image_processing/render.py index 7bc045f..557268a 100644 --- a/backend/applications/image_processing/render.py +++ b/backend/applications/image_processing/render.py @@ -1,12 +1,8 @@ -# 推理结果展示 -# 重复运行本单元可以查看不同结果 - import os.path as osp import cv2 from PIL import Image from matplotlib import pyplot as plt -from skimage.io import imread from applications.common.path_global import md5_name, generate_url @@ -22,7 +18,6 @@ def show_images_in_row( map = plt.cm.ocean # 森林 if colormap == 3: map = plt.cm.rainbow # 霓虹 - # fig.suptitle(title) axs = fig.subplots(nrows=1, ncols=1) axs.spines['top'].set_visible(False) axs.spines['right'].set_visible(False) @@ -30,10 +25,8 @@ def show_images_in_row( axs.spines['left'].set_visible(False) axs.get_xaxis().set_ticks([]) axs.get_yaxis().set_ticks([]) - - im = imread(im_paths) - if im.ndim == 3: - im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) + im = cv2.imread(im_paths) + im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) axs.imshow(im, cmap=map) @@ -41,26 +34,23 @@ def render(name, data_dir, save_dir, colormap): # 实现渲染的函数,考虑到我们的需要一次只能渲染一张,pic_source一样为图片位置 # 参考 https://stackoverflow.com/a/68209152 fig = plt.figure(constrained_layout=True) - # fig.suptitle("") 设置标题用的,我们不用设置标题,因为下面已经设置了 subfigs = fig.subfigures(nrows=1, ncols=1) # 读入变化图 pic_source = osp.join(data_dir, name) show_images_in_row( - pic_source, subfigs, title='Change Map', - colormap=colormap) # title为changemap,换成中文会乱码,勿换 + pic_source, subfigs, title='Change Map', colormap=colormap) # 渲染结果 fig.canvas.draw() Image.frombytes('RGB', fig.canvas.get_width_height(), fig.canvas.tostring_rgb()) - # plt.show() new_name = md5_name(str(colormap) + "_" + name) plt.savefig(osp.join(save_dir, new_name), bbox_inches='tight') return new_name # 批量渲染 -def bitch_render(data_dir, save_dir, imgs): +def batch_render(data_dir, save_dir, imgs): temps = list() for img in imgs: maps = dict() diff --git a/backend/applications/interface/analysis.py b/backend/applications/interface/analysis.py index da968ee..9ee4e9f 100644 --- a/backend/applications/interface/analysis.py +++ b/backend/applications/interface/analysis.py @@ -10,7 +10,7 @@ from applications.image_processing.gaussian_blur import gaussian_blur from applications.image_processing.hole import hole_fill from applications.image_processing.median_blur import median_blur -from applications.image_processing.render import bitch_render +from applications.image_processing.render import batch_render from applications.image_processing.render_seg import bitch_render_seg from applications.image_processing.resize import resize from applications.image_processing.sharpen import sharpen @@ -272,7 +272,7 @@ def handle(fun_type, imgs, src_dir, save_dir): elif fun_type == fun_type_5: temps = gaussian_blur(src_dir, save_dir, imgs) elif fun_type == fun_type_6: - temps = bitch_render(src_dir, save_dir, imgs) + temps = batch_render(src_dir, save_dir, imgs) elif fun_type == fun_type_7: temps = bitch_render_seg(src_dir, save_dir, imgs) elif fun_type == fun_type_8: diff --git a/backend/applications/interface/change_detection.py b/backend/applications/interface/change_detection.py index 5df267c..81d6720 100644 --- a/backend/applications/interface/change_detection.py +++ b/backend/applications/interface/change_detection.py @@ -41,7 +41,7 @@ def execute(model_path, data_path, out_dir, names_): return_list=True) # 设置滑窗大小与滑动步长 WINDOW_SIZE = 256 - STRIDE = 128 + STRIDE = 256 ORIGINAL_SIZE = (1024, 1024) diff --git a/backend/applications/interface/classification.py b/backend/applications/interface/classification.py index 202aad3..6662f97 100644 --- a/backend/applications/interface/classification.py +++ b/backend/applications/interface/classification.py @@ -1,19 +1,12 @@ -# 导入需要用到的库 import os.path as osp -import cv2 import paddlers as pdrs - - -def read_rgb(path): - im = cv2.imread(path) - im = im[..., ::-1] - return im +from paddlers.transforms import decode_image def execute(model_path, data_path, names): image_list = [osp.join(data_path, name) for name in names] - ims = [read_rgb(i) for i in image_list] + ims = [decode_image(i) for i in image_list] predictor = pdrs.deploy.Predictor(model_path, use_gpu=True) temps = predictor.predict(ims) return temps diff --git a/backend/applications/interface/object_detection.py b/backend/applications/interface/object_detection.py index 0c393f2..24babf6 100644 --- a/backend/applications/interface/object_detection.py +++ b/backend/applications/interface/object_detection.py @@ -1,58 +1,38 @@ # 导入需要用到的库 import os.path as osp -import cv2 -import numpy as np import paddle +import numpy as np +from paddlers.models.ppdet.utils.colormap import colormap +from skimage.io import imsave + import paddlers as pdrs +from paddlers.transforms import decode_image from paddlers.tasks.utils.visualize import visualize_detection -from skimage.io import imsave from applications.common.path_global import md5_name, generate_url -def read_rgb(path): - im = cv2.imread(path) - im = im[..., ::-1] - return im - - def execute(model_path, data_path, out_dir, names): """ - :param model_path: 模型路径 :param data_path: 数据文件夹路径,里面只包含图片 :param out_dir: 结果保存路径 - :return: None """ - # names = listdir(data_path) - # 对文件名进行排序,以确保多次运行结果一致 - # names.sort() image_list = [osp.join(data_path, name) for name in names] predictor = pdrs.deploy.Predictor(model_dir=model_path, use_gpu=True) pred = predictor.predict(image_list) - print('预测完毕!') - # 参考 https://stackoverflow.com/a/68209152 # 读取输入影像 - ims = [read_rgb(i) for i in image_list] + ims = [decode_image(i) for i in image_list] temps = list() # 绘制目标框 with paddle.no_grad(): for idx, im in zip(range(len(names)), ims): - im = cv2.resize( - im[..., ::-1], (608, 608), interpolation=cv2.INTER_CUBIC) vis = im - # 用绿色画出预测目标框 + # 绘制预测目标框 if len(pred[idx]) > 0: vis = visualize_detection( - np.array(vis), - pred[idx], - color=np.asarray( - [[0, 255, 0], [0, 255, 0], [0, 255, 0], [0, 255, 0]], - dtype=np.uint8), - threshold=0.2, - save_dir=None) - vis = cv2.cvtColor(vis, cv2.COLOR_RGB2BGR) + np.array(vis), pred[idx], threshold=0.5, save_dir=None) name = names[idx] new_name = md5_name(name) imsave(osp.join(out_dir, new_name), vis) diff --git a/backend/applications/interface/semantic_segmentation.py b/backend/applications/interface/semantic_segmentation.py index 7f0450e..4ee7bc9 100644 --- a/backend/applications/interface/semantic_segmentation.py +++ b/backend/applications/interface/semantic_segmentation.py @@ -14,7 +14,7 @@ def get_lut(): lut[1] = [30, 255, 142] # 浅绿 lut[2] = [60, 0, 255] # 蓝 lut[3] = [255, 222, 0] # 橙黄 - lut[4] = [0, 0, 0] # 黑 + lut[4] = [255, 0, 255] # 粉 return lut @@ -26,8 +26,6 @@ def execute(model_path, data_path, out_dir, test_names): lut = get_lut() temps = list() for idx, im in zip(range(len(image_list)), ims): - if im.ndim == 3: - im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) im = lut[im] new_name = md5_name(test_names[idx]) imsave(osp.join(out_dir, new_name), im) diff --git a/frontend/package.json b/frontend/package.json index d0aee5a..f96f4df 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,20 +10,17 @@ "@vueuse/core": "^8.5.0", "axios": "^0.26.1", "core-js": "^3.8.3", - "echarts": "^5.3.2", "element-plus": "2.1.10", "eslint": "^8.23.1", "eslint-plugin-vue": "^9.5.1", "file-saver": "^2.0.5", "html2canvas": "^1.4.1", "jszip": "^3.9.1", - "scrollreveal": "^4.0.9", "vue": "^3.2.13", "vue-cropper": "^1.0.3", "vue-keep-scroll-position": "^0.1.2", "vue-popperjs": "^2.3.0", - "vue-router": "^4.0.3", - "vuex": "^4.0.0" + "vue-router": "^4.0.3" }, "devDependencies": { "@vue/cli-plugin-babel": "~5.0.0", @@ -31,8 +28,7 @@ "@vue/cli-plugin-vuex": "~5.0.0", "@vue/cli-service": "~5.0.0", "less": "^4.0.0", - "less-loader": "^8.0.0", - "vue-particles": "^1.0.9" + "less-loader": "^8.0.0" }, "browserslist": [ "> 1%", diff --git a/frontend/public/index.html b/frontend/public/index.html index 2a70665..cda74db 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -21,7 +21,7 @@
-
正在加载Hippo智能遥感解译平台,请耐心等待... +
正在加载PP-GeoView智能遥感解译平台,请耐心等待...

v1.0

diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 320f411..b384a1c 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -9,14 +9,11 @@
diff --git a/frontend/src/api/request.js b/frontend/src/api/request.js index 9f639d8..ff4d89f 100644 --- a/frontend/src/api/request.js +++ b/frontend/src/api/request.js @@ -1,6 +1,6 @@ import axios from "axios" import router from '../router' -import store from '@/store' + import global from '@/global' import { hideFullScreenLoading} from '@/utils/loading' import { ElMessage } from 'element-plus' diff --git a/frontend/src/api/requestfile.js b/frontend/src/api/requestfile.js index 8e0f6ae..2baf0f1 100644 --- a/frontend/src/api/requestfile.js +++ b/frontend/src/api/requestfile.js @@ -1,6 +1,6 @@ import axios from "axios" import router from '../router' -import store from "@/store" + import global from '@/global' export function requestfile(config) { const instance = axios.create({ diff --git a/frontend/src/api/upload.js b/frontend/src/api/upload.js index 1d95662..76ea233 100644 --- a/frontend/src/api/upload.js +++ b/frontend/src/api/upload.js @@ -15,6 +15,14 @@ export function createSrc(formdata) { }) } +export function sceneClassifyUpload(data) { + return request({ + method: 'POST', + url: '/api/analysis/classification', + data, + }) +} + export function classifyUpload(data) { return request({ method: 'POST', diff --git a/frontend/src/assets/font/iconfont.css b/frontend/src/assets/font/iconfont.css index 48fe2a9..c7928b2 100644 --- a/frontend/src/assets/font/iconfont.css +++ b/frontend/src/assets/font/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 3317298 */ - src: url('iconfont.woff2?t=1659272007979') format('woff2'), - url('iconfont.woff?t=1659272007979') format('woff'), - url('iconfont.ttf?t=1659272007979') format('truetype'); + src: url('iconfont.woff2?t=1663923711435') format('woff2'), + url('iconfont.woff?t=1663923711435') format('woff'), + url('iconfont.ttf?t=1663923711435') format('truetype'); } .iconfont { @@ -13,6 +13,14 @@ -moz-osx-font-smoothing: grayscale; } +.icon-changjingguanli:before { + content: "\eb61"; +} + +.icon-changjingmoren:before { + content: "\e629"; +} + .icon-zaixianditu:before { content: "\e61e"; } diff --git a/frontend/src/assets/font/iconfont.ttf b/frontend/src/assets/font/iconfont.ttf index 49c19db..71157cc 100644 Binary files a/frontend/src/assets/font/iconfont.ttf and b/frontend/src/assets/font/iconfont.ttf differ diff --git a/frontend/src/assets/font/iconfont.woff b/frontend/src/assets/font/iconfont.woff index e8146de..f79a4e3 100644 Binary files a/frontend/src/assets/font/iconfont.woff and b/frontend/src/assets/font/iconfont.woff differ diff --git a/frontend/src/assets/font/iconfont.woff2 b/frontend/src/assets/font/iconfont.woff2 index 1d4928a..d211b73 100644 Binary files a/frontend/src/assets/font/iconfont.woff2 and b/frontend/src/assets/font/iconfont.woff2 differ diff --git a/frontend/src/components/AsideVue.vue b/frontend/src/components/AsideVue.vue index ecaf867..ac393dc 100644 --- a/frontend/src/components/AsideVue.vue +++ b/frontend/src/components/AsideVue.vue @@ -13,7 +13,7 @@ :src="require('@/assets/image/logo/80.png')" style="width:45px;color:rgb(64,158,255);" alt="logo" - @click="goRemoteSense" + @click="goDetectChanges" >
+
+ + +

+ 场景分类 +

+
+
- web developement based on vue3 + elememnt ui + axios - + /> 地物分类 + +

+ 场景分类 +

+
\ No newline at end of file diff --git a/frontend/src/components/MyVueCropper.vue b/frontend/src/components/MyVueCropper.vue index 5ad9f50..e88520e 100644 --- a/frontend/src/components/MyVueCropper.vue +++ b/frontend/src/components/MyVueCropper.vue @@ -86,6 +86,7 @@ import { createSrc, classifyUpload, detectTargetsUpload, + sceneClassifyUpload, } from "@/api/upload"; import { showFullScreenLoading, hideFullScreenLoading } from "@/utils/loading"; import { getUploadImg, upload, goCompress } from "@/utils/getUploadImg"; @@ -170,6 +171,7 @@ export default { createSrc, classifyUpload, detectTargetsUpload, + sceneClassifyUpload, getUploadImg, upload, goCompress, @@ -272,6 +274,16 @@ export default { this.getUploadImg("目标检测"); }); } + else if (funtype === "场景分类") { + delete this.uploadSrc.prehandle + delete this.uploadSrc.denoise + this.sceneClassifyUpload(this.uploadSrc).then((res) => { + this.fileList = []; + hideFullScreenLoading("#load"); + this.$message.success("上传成功!"); + this.getUploadImg("场景分类"); + }); + } this.$emit("cut-changed", false); }); }); diff --git a/frontend/src/main.js b/frontend/src/main.js index c4932e2..0121967 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -3,16 +3,15 @@ import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import App from './App.vue' import router from './router' -import store from './store' import '@/assets/font/iconfont.css' import './assets/css/normalize.css' import '@/assets/css/app.css' import 'element-plus/theme-chalk/display.css' -import VueParticles from 'vue-particles' + import JSZIP from "jszip" import zhCn from 'element-plus/es/locale/lang/zh-cn' -createApp(App).use(store).use(router).use(ElementPlus,{locale: zhCn}).use(VueParticles).use(JSZIP).mount('#app') \ No newline at end of file +createApp(App).use(router).use(ElementPlus,{locale: zhCn}).use(JSZIP).mount('#app') \ No newline at end of file diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index eb93267..146b8ec 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -4,6 +4,7 @@ const Home = () => import('@/views/Home.vue') const DetectChanges = () => import('@/views/mainfun/DetectChanges.vue') const DetectTargets = () => import('@/views/mainfun/DetectTargets.vue') const Classify = () => import('@/views/mainfun/Classify.vue') +const ClassifyScene = ()=> import('@/views/mainfun/ClassifyScene') const OnlineMap = () => import('@/views/mainfun/OnlineMap.vue') const History = () => import('@/views/history/History.vue') const NotFound = () => import('@/views/NotFound.vue') @@ -30,7 +31,13 @@ const routes = [ path: '/classify', name: 'classify', component: Classify - }, { + }, + { + path: '/classifyscene', + name:'classifyscene', + component:ClassifyScene + }, + { path: '/history', name: 'history', component: History, diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js deleted file mode 100644 index a41cfd9..0000000 --- a/frontend/src/store/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import { createStore } from 'vuex' - -export default createStore({ - state(){ - return{ - - } - }, - getters: { - }, - mutations: { - }, - actions: { - }, - modules: { - } -}) diff --git a/frontend/src/utils/download.js b/frontend/src/utils/download.js index ce708aa..b7c49e5 100644 --- a/frontend/src/utils/download.js +++ b/frontend/src/utils/download.js @@ -2,7 +2,7 @@ import JSZIP from "jszip" import FileSaver from 'file-saver' import { showCompressLoading, hideCompressLoading,} from "@/utils/loading"; -import store from '@/store' + import global from '@/global' function downloadimgWithWords(index, src, funtype) { fetch(src) diff --git a/frontend/src/utils/getUploadImg.js b/frontend/src/utils/getUploadImg.js index fc3fbb7..4d20790 100644 --- a/frontend/src/utils/getUploadImg.js +++ b/frontend/src/utils/getUploadImg.js @@ -1,11 +1,10 @@ import { historyGetPage } from "@/api/history" -import store from "@/store"; import { showFullScreenLoading, hideFullScreenLoading } from "@/utils/loading"; import global from '@/global' + function getUploadImg(type) { - // showFullScreenLoading("#load"); + showFullScreenLoading("#load"); historyGetPage(1, 20, type).then((res) => { - hideFullScreenLoading("#load") this.beforeImg = res.data.data.map((item) => { return { before_img: global.BASEURL + item.before_img }; @@ -18,6 +17,10 @@ function getUploadImg(type) { return { before_img1: global.BASEURL + item.before_img1 }; }); } + if (type === '场景分类') { + this.scene = res.data.data.map(item=>item.data) //场景键值对数组,[{'a':0.8},{‘b’:0.6},{'c':0.8}] + this.sceneKey = this.scene.map(item=>Object.keys(item)) //构成场景键数组的数组,[['a'],['b'],['c']] + } this.afterImg = res.data.data.map((item) => { return { after_img: global.BASEURL + item.after_img, id: item.id }; }); @@ -93,7 +96,15 @@ function upload(type) { this.getMore() }) } - if (this.afterImg.length >= 20) { + else if (type === '场景分类') { + this.sceneClassifyUpload(this.uploadSrc).then((res) => { + this.fileList = [] + hideFullScreenLoading("#load") + this.$message.success("上传成功!"); + this.getMore() + }) + } + if (this.afterImg.length >= 20 && type!=='场景分类') { this.$confirm("上传图片过多,是否压缩?在此期间不能进行其他操作", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", diff --git a/frontend/src/utils/gosomewhere.js b/frontend/src/utils/gosomewhere.js index bf2c454..80bf9fa 100644 --- a/frontend/src/utils/gosomewhere.js +++ b/frontend/src/utils/gosomewhere.js @@ -17,6 +17,14 @@ function goClassify() { this.$message.success('您已经在该界面了哦') } else this.$router.push("classify"); } + +function goClassifyScene() { + this.drawer = false; + if (this.$route.path === "/classifyscene") { + this.$message.success('您已经在该界面了哦') + } else this.$router.push("classifyscene"); +} + function goOnlineMap(){ this.drawer = false if (this.$route.path === "/onlinemap") { @@ -31,4 +39,4 @@ function goHistory() { }); } -export { goDetectChanges, goDetectTargets, goClassify,goOnlineMap, goHistory } +export { goDetectChanges, goDetectTargets, goClassify,goClassifyScene,goOnlineMap, goHistory } diff --git a/frontend/src/utils/preview.js b/frontend/src/utils/preview.js index 68a34d5..b8d799d 100644 --- a/frontend/src/utils/preview.js +++ b/frontend/src/utils/preview.js @@ -1,4 +1,4 @@ -import store from '@/store' + import global from '@/global' function previewOnePic(pic) { this.flag = 1 diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index 32fd942..fc378e7 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -32,7 +32,7 @@ mode="out-in" > diff --git a/frontend/src/views/history/History.vue b/frontend/src/views/history/History.vue index a8fcd98..19eb55a 100644 --- a/frontend/src/views/history/History.vue +++ b/frontend/src/views/history/History.vue @@ -7,6 +7,7 @@ 'iconfont icon-bianhuajiance': type === '变化检测', 'iconfont icon-mubiaojiance': type === '目标检测', 'iconfont icon-erfenleibianhuajiance16px': type === '地物分类', + 'iconfont icon-changjingguanli' : type === '场景分类' }" />
@@ -32,6 +33,7 @@ 'iconfont icon-mubiaojiance': scope.row.type === '目标检测', 'iconfont icon-erfenleibianhuajiance16px': scope.row.type === '地物分类', + 'iconfont icon-changjingguanli' : scope.row.type === '场景分类' }" />{{ scope.row.type }} @@ -60,9 +62,10 @@ > - + @@ -83,7 +90,7 @@ 删除 + 预览 + + +

+ 场景分类 +

+ { hideFullScreenLoading(".his-box"); @@ -487,6 +514,11 @@ export default { this.getTabelInfo(); this.fundrawer = false; }, + onlyClassifyScene() { + this.type = "场景分类"; + this.getTabelInfo(); + this.fundrawer = false; + }, goBackData() { this.type = ""; this.getTabelInfo(); diff --git a/frontend/src/views/mainfun/ClassifyScene.vue b/frontend/src/views/mainfun/ClassifyScene.vue new file mode 100644 index 0000000..a4478aa --- /dev/null +++ b/frontend/src/views/mainfun/ClassifyScene.vue @@ -0,0 +1,466 @@ +