文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 04087a72 by 李景熙

Merge remote-tracking branch 'origin/develop' into develop

parents c241249b b62aa289
var baseURL = 'http://47.92.1.107/api' let isTest = true
// let isTest = false
if (!isTest)
var baseURL = 'http://47.92.1.107/api'
else
var baseURL = 'http://localhost:9100/api'
export { export {
baseURL baseURL
......
...@@ -868,6 +868,7 @@ export default { ...@@ -868,6 +868,7 @@ export default {
const newLabel = { const newLabel = {
labelId: currentLabelId, labelId: currentLabelId,
labelName: labelName, labelName: labelName,
correct: 0,
pointList: pointList pointList: pointList
} }
this.data[currentImageId].children.push(newLabel) this.data[currentImageId].children.push(newLabel)
......
...@@ -204,7 +204,7 @@ export default { ...@@ -204,7 +204,7 @@ export default {
let baseURL = this.baseURL let baseURL = this.baseURL
// 获取图片列表并转换格式 // 获取图片列表并转换格式
let imageList = await this.getLabelList() let imageList = await this.getLabelList()
// console.log(imageList) console.log(imageList)
this.imageList = imageList.imageList this.imageList = imageList.imageList
// 加载第一张图片 // 加载第一张图片
...@@ -276,6 +276,7 @@ export default { ...@@ -276,6 +276,7 @@ export default {
// 还原数据库里的标注记录 // 还原数据库里的标注记录
let id = _this.pictureId let id = _this.pictureId
// console.log('id = ' + id) // console.log('id = ' + id)
// console.log(_this.data)
_this.data.forEach(function (element, index) { _this.data.forEach(function (element, index) {
var indexPic = index var indexPic = index
...@@ -286,8 +287,13 @@ export default { ...@@ -286,8 +287,13 @@ export default {
num.push(element1.Y) num.push(element1.Y)
}) })
_this.canvasAll[indexPic].push(num) _this.canvasAll[indexPic].push(num)
_this.canvasAllCheck.push(0)
_this.value.push(false) _this.canvasAllCheck.push(element.correct)
if(element.correct == 0){
_this.value.push(false)
} else {
_this.value.push(true)
}
}) })
}) })
// 还原标注 // 还原标注
...@@ -332,14 +338,19 @@ export default { ...@@ -332,14 +338,19 @@ export default {
watch: { watch: {
value: function fn() { value: function fn() {
var tmp = this.canvasAllCheck; var tmp = this.canvasAllCheck;
let _this = this
this.value.forEach((e, index) => { this.value.forEach((e, index) => {
if (tmp[index] == 0) { if (tmp[index] == 0) {
if (e == true) { if (e == true) {
_this.data[0].children[index].correct = 2;
tmp[index] = 2; tmp[index] = 2;
console.log(_this.data)
} }
} else if (tmp[index] == 2) { } else if (tmp[index] == 2) {
if (e == false) { if (e == false) {
_this.data[0].children[index].correct = 0;
tmp[index] = 0; tmp[index] = 0;
console.log(_this.data)
} }
} }
}) })
...@@ -882,6 +893,7 @@ export default { ...@@ -882,6 +893,7 @@ export default {
} }
// pointList完成 // pointList完成
const newLabel = { const newLabel = {
correct: 1,
labelId: currentLabelId, labelId: currentLabelId,
labelName: labelName, labelName: labelName,
pointList: pointList pointList: pointList
...@@ -1053,6 +1065,7 @@ export default { ...@@ -1053,6 +1065,7 @@ export default {
// _this.ctx.clearRect(0, 0, _this.canvas.width, _this.canvas.height) // _this.ctx.clearRect(0, 0, _this.canvas.width, _this.canvas.height)
_this.canvasAll[id].push(num) _this.canvasAll[id].push(num)
_this.canvasAllCheck.push(1) _this.canvasAllCheck.push(1)
_this.value.push(false) _this.value.push(false)
_this.restoreCanvas() _this.restoreCanvas()
...@@ -1168,7 +1181,7 @@ export default { ...@@ -1168,7 +1181,7 @@ export default {
}) })
// console.log('outputdata') // console.log('outputdata')
// console.log(outputData) console.log(outputData)
this.submit() this.submit()
...@@ -1192,7 +1205,7 @@ export default { ...@@ -1192,7 +1205,7 @@ export default {
// //message: `action: ${action}` // //message: `action: ${action}`
// }) // })
} }
}) })
this.$router.push({ path: "/check" }) this.$router.push({ path: "/check" })
......
...@@ -601,6 +601,7 @@ export default { ...@@ -601,6 +601,7 @@ export default {
X: position.X, X: position.X,
Y: position.Y, Y: position.Y,
landmarkId: currentId, landmarkId: currentId,
correct: 0,
landmarkName: landmarkName landmarkName: landmarkName
} }
this.landmarkData.push(newlandmark) this.landmarkData.push(newlandmark)
...@@ -688,6 +689,7 @@ export default { ...@@ -688,6 +689,7 @@ export default {
const newLabel = { const newLabel = {
labelId: currentId, labelId: currentId,
labelName: labelName, labelName: labelName,
correct: 0,
pointList: pointList pointList: pointList
} }
this.layerData.push(newLabel) this.layerData.push(newLabel)
...@@ -751,6 +753,7 @@ export default { ...@@ -751,6 +753,7 @@ export default {
const newLabel = { const newLabel = {
labelId: currentId, labelId: currentId,
labelName: labelName, labelName: labelName,
correct: 0,
pointList: pointList pointList: pointList
} }
this.layerData.push(newLabel) this.layerData.push(newLabel)
......
...@@ -209,8 +209,12 @@ export default { ...@@ -209,8 +209,12 @@ export default {
data () { data () {
return { return {
computeScore: 0, computeScore: 0,
value: [], value: [],// 地标checkbox
value2: [], value2: [],// 区域标注checkbox
checkLayer: [], // 区域标注审核结果
checkLand: [], // 地标标注审核结果
layerData: null, // layerdata存放标注数据
landmarkData: null, // 存放地标数据
activeName: 'first', activeName: 'first',
isPoint: true, isPoint: true,
centerX: 0, centerX: 0,
...@@ -226,10 +230,7 @@ export default { ...@@ -226,10 +230,7 @@ export default {
radio1: '地标', radio1: '地标',
activeIndex1: 1, activeIndex1: 1,
hasSaved: 1, // 保存标志 hasSaved: 1, // 保存标志
checkLayer: [],
checkLand: [],
layerData: null, // layerdata存放标注数据
landmarkData: null, // 存放地标数据
relationId: null, // 当前任务的relationID relationId: null, // 当前任务的relationID
clickedPosition: null, // 保存最新一次点击的结果,没有使用 clickedPosition: null, // 保存最新一次点击的结果,没有使用
map: null, map: null,
...@@ -258,18 +259,33 @@ export default { ...@@ -258,18 +259,33 @@ export default {
// 避免第一次标注时数据库中没有内容的情况 // 避免第一次标注时数据库中没有内容的情况
if (res.layerInfo != null) { if (res.layerInfo != null) {
this.layerData = res.layerInfo.labelList; this.layerData = res.layerInfo.labelList;
console.log('this.layerData')
console.log(this.layerData)
for (let i = 0;i < this.layerData.length;i++) { for (let i = 0;i < this.layerData.length;i++) {
this.checkLayer.push(0) let tmpCorrect = this.layerData[i].correct
this.value2.push(false) this.checkLayer.push(tmpCorrect)
if (tmpCorrect != 0) {
this.value2.push(true)
} else {
this.value2.push(false)
}
} }
} else { this.layerData = [] } } else { this.layerData = [] }
// console.log(this.layerData) // console.log(this.layerData)
if (res.landmarkList != null) { if (res.landmarkList != null) {
this.landmarkData = res.landmarkList.landmarkEntityList; this.landmarkData = res.landmarkList.landmarkEntityList;
console.log('this.landmarkData')
console.log(this.landmarkData)
for (let i = 0;i < this.landmarkData.length;i++) { for (let i = 0;i < this.landmarkData.length;i++) {
this.checkLand.push(0) let tmpCorrect = this.landmarkData[i].correct
this.value.push(false) // alert(tmpCorrect)
this.checkLand.push(tmpCorrect)
if (tmpCorrect != 0) {
this.value.push(true)
} else {
this.value.push(false)
}
} }
} else { this.landmarkData = [] } } else { this.landmarkData = [] }
// console.log(this.landmarkData) // console.log(this.landmarkData)
...@@ -312,14 +328,26 @@ export default { ...@@ -312,14 +328,26 @@ export default {
watch: { watch: {
value: function fn() { value: function fn() {
var tmp = this.checkLand; var tmp = this.checkLand;
this.value.forEach((e, index) => { this.value.forEach((e, index) => {
console.log('tmp')
console.log(tmp[index])
console.log(e)
if (tmp[index] == 0) { if (tmp[index] == 0) {
if (e == true) { if (e == true) {
tmp[index] = 2; tmp[index] = 2;
this.landmarkData[index].correct = 2;
console.log('this.landmarkData[index]')
console.log(this.landmarkData[index])
} }
} else if (tmp[index] == 2) { } else if (tmp[index] == 2) {
if (e == false) { if (e == false) {
tmp[index] = 0; tmp[index] = 0;
this.landmarkData[index].correct = 0;
console.log('this.landmarkData[index]')
console.log(this.landmarkData[index])
} }
} }
}) })
...@@ -332,10 +360,17 @@ export default { ...@@ -332,10 +360,17 @@ export default {
if (tmp[index] == 0) { if (tmp[index] == 0) {
if (e == true) { if (e == true) {
tmp[index] = 2; tmp[index] = 2;
this.layerData[index].correct = 2;
console.log('this.layerData[index]')
console.log(this.layerData[index])
} }
} else if (tmp[index] == 2) { } else if (tmp[index] == 2) {
if (e == false) { if (e == false) {
tmp[index] = 0; tmp[index] = 0;
this.layerData[index].correct = 0;
console.log('this.layerData[index]')
console.log(this.layerData[index])
} }
} }
}) })
...@@ -632,7 +667,8 @@ export default { ...@@ -632,7 +667,8 @@ export default {
if (res.code === 1) { if (res.code === 1) {
let layerInfo = res.data.layerInfo let layerInfo = res.data.layerInfo
let landmarkList = res.data.landmarkList let landmarkList = res.data.landmarkList
// console.log(res.data) console.log(res.data)
// 0是标注者标注错误的,1是标注者标注正确的,2是审核者自己添加的
return { return {
layerInfo: layerInfo, layerInfo: layerInfo,
landmarkList: landmarkList landmarkList: landmarkList
...@@ -680,6 +716,7 @@ export default { ...@@ -680,6 +716,7 @@ export default {
let newlandmark = { let newlandmark = {
X: position.X, X: position.X,
Y: position.Y, Y: position.Y,
correct: 1,
landmarkId: currentId, landmarkId: currentId,
landmarkName: landmarkName landmarkName: landmarkName
} }
...@@ -770,7 +807,8 @@ export default { ...@@ -770,7 +807,8 @@ export default {
const newLabel = { const newLabel = {
labelId: currentId, labelId: currentId,
labelName: labelName, labelName: labelName,
pointList: pointList pointList: pointList,
correct: 1
} }
this.layerData.push(newLabel) this.layerData.push(newLabel)
this.checkLayer.push(1) this.checkLayer.push(1)
...@@ -835,7 +873,8 @@ export default { ...@@ -835,7 +873,8 @@ export default {
const newLabel = { const newLabel = {
labelId: currentId, labelId: currentId,
labelName: labelName, labelName: labelName,
pointList: pointList pointList: pointList,
correct: 1
} }
this.layerData.push(newLabel) this.layerData.push(newLabel)
this.checkLayer.push(1) this.checkLayer.push(1)
......
...@@ -37,6 +37,7 @@ class Point(db.EmbeddedDocument): ...@@ -37,6 +37,7 @@ class Point(db.EmbeddedDocument):
class Label(db.EmbeddedDocument): class Label(db.EmbeddedDocument):
labelId = db.IntField(required=True) labelId = db.IntField(required=True)
labelName = db.StringField(required=True) labelName = db.StringField(required=True)
correct = db.IntField(required=True)
lineColor = db.ListField(db.IntField()) lineColor = db.ListField(db.IntField())
fillColor = db.ListField(db.IntField()) fillColor = db.ListField(db.IntField())
pointList = db.ListField(db.EmbeddedDocumentField(Point)) pointList = db.ListField(db.EmbeddedDocumentField(Point))
...@@ -44,6 +45,7 @@ class Label(db.EmbeddedDocument): ...@@ -44,6 +45,7 @@ class Label(db.EmbeddedDocument):
def to_json(self): def to_json(self):
return {'labelId': self.labelId, return {'labelId': self.labelId,
'labelName': self.labelName, 'labelName': self.labelName,
'correct': self.correct,
'pointList': [i.to_json() for i in self.pointList] 'pointList': [i.to_json() for i in self.pointList]
} }
...@@ -83,6 +85,7 @@ def create_labels(label_list): ...@@ -83,6 +85,7 @@ def create_labels(label_list):
label = Label( label = Label(
labelId=i['labelId'], labelId=i['labelId'],
labelName=i['labelName'], labelName=i['labelName'],
correct=i['correct'],
lineColor=list(c), lineColor=list(c),
fillColor=list(c), fillColor=list(c),
pointList=create_points(i['pointList']) pointList=create_points(i['pointList'])
...@@ -145,11 +148,13 @@ def get_img_colors(relation_id): ...@@ -145,11 +148,13 @@ def get_img_colors(relation_id):
# 获取标注图片的坐标列表 # 获取标注图片的坐标列表
def get_img_point_lists(relation_id): def get_img_point_lists(relation_id, label_filter=False):
obj = Image.objects(relationId=relation_id).first() obj = Image.objects(relationId=relation_id).first()
point_lists = [] point_lists = []
label_list = obj['labelList'] label_list = obj['labelList']
for i in label_list: for i in label_list:
if label_filter and i['correct'] == 0:
continue
points = i['pointList'] points = i['pointList']
sub_list = [] sub_list = []
for j in points: for j in points:
...@@ -189,7 +194,7 @@ def export_original_img_bytes(relation_id): ...@@ -189,7 +194,7 @@ def export_original_img_bytes(relation_id):
# 根据relationId获取图片json对象 # 根据relationId获取图片json对象
def export_img_json_bytes(relation_id): def export_img_json_bytes(relation_id, label_filter=False):
try: try:
ret = {'version': '3.10.0', 'flags': {}} ret = {'version': '3.10.0', 'flags': {}}
obj = Image.objects(relationId=relation_id).first() obj = Image.objects(relationId=relation_id).first()
...@@ -201,15 +206,19 @@ def export_img_json_bytes(relation_id): ...@@ -201,15 +206,19 @@ def export_img_json_bytes(relation_id):
shapes = [] shapes = []
for i, line_color, fill_color in zip(label_list, line_colors, fill_colors): for i, line_color, fill_color in zip(label_list, line_colors, fill_colors):
if label_filter and i['correct'] == 0:
continue
shape = {} shape = {}
label_name = i['labelName'] label_name = i['labelName']
point_list = i['pointList'] point_list = i['pointList']
correct = i['correct']
points = [] points = []
for j in point_list: for j in point_list:
points.append([j['X'], j['Y']]) points.append([j['X'], j['Y']])
shape['label'] = label_name shape['label'] = label_name
shape['line_color'] = line_color shape['line_color'] = line_color
shape['fill_color'] = fill_color shape['fill_color'] = fill_color
shape['correct'] = correct
shape['points'] = points shape['points'] = points
shape['shape_type'] = 'polygon' shape['shape_type'] = 'polygon'
shapes.append(shape) shapes.append(shape)
...@@ -250,7 +259,7 @@ def export_label_img_bytes(relation_id): ...@@ -250,7 +259,7 @@ def export_label_img_bytes(relation_id):
return Result(0, msg['errmsg'], {}) return Result(0, msg['errmsg'], {})
line_colors, fill_colors = get_img_colors(relation_id) line_colors, fill_colors = get_img_colors(relation_id)
points_lists = get_img_point_lists(relation_id) points_lists = get_img_point_lists(relation_id, True)
img = PIL.Image.new("RGBA", img_size, (0, 0, 0, 255)) img = PIL.Image.new("RGBA", img_size, (0, 0, 0, 255))
draw = PIL.ImageDraw.Draw(img) draw = PIL.ImageDraw.Draw(img)
...@@ -342,12 +351,14 @@ def delete_layer(relation_id): ...@@ -342,12 +351,14 @@ def delete_layer(relation_id):
class LandmarkEntity(db.EmbeddedDocument): class LandmarkEntity(db.EmbeddedDocument):
landmarkId = db.IntField(required=True) landmarkId = db.IntField(required=True)
landmarkName = db.StringField() landmarkName = db.StringField()
correct = db.IntField(required=True)
X = db.FloatField(required=True) X = db.FloatField(required=True)
Y = db.FloatField(required=True) Y = db.FloatField(required=True)
def to_json(self): def to_json(self):
return {'landmarkId': self.landmarkId, return {'landmarkId': self.landmarkId,
'landmarkName': self.landmarkName, 'landmarkName': self.landmarkName,
'correct': self.correct,
'X': self.X, 'X': self.X,
'Y': self.Y} 'Y': self.Y}
...@@ -372,6 +383,7 @@ def create_landmark_entities(landmark_entity_list): ...@@ -372,6 +383,7 @@ def create_landmark_entities(landmark_entity_list):
landmark_entity = LandmarkEntity( landmark_entity = LandmarkEntity(
landmarkId=i['landmarkId'], landmarkId=i['landmarkId'],
landmarkName=i['landmarkName'], landmarkName=i['landmarkName'],
correct=i['correct'],
X=i['X'], X=i['X'],
Y=i['Y'] Y=i['Y']
) )
......
...@@ -164,7 +164,7 @@ def export_zip(relationId): ...@@ -164,7 +164,7 @@ def export_zip(relationId):
# 3 files' Bytes # 3 files' Bytes
original_img_bytes = Image.export_original_img_bytes(relationId) original_img_bytes = Image.export_original_img_bytes(relationId)
label_img_bytes = Image.export_label_img_bytes(relationId) label_img_bytes = Image.export_label_img_bytes(relationId)
_, json_img_bytes = Image.export_img_json_bytes(relationId) _, json_img_bytes = Image.export_img_json_bytes(relationId, True)
bytes = [original_img_bytes, json_img_bytes, label_img_bytes] bytes = [original_img_bytes, json_img_bytes, label_img_bytes]
types = [image_name + '.' + img_type, image_name + '.json', image_name + '_label.' + img_type] types = [image_name + '.' + img_type, image_name + '.json', image_name + '_label.' + img_type]
...@@ -205,8 +205,9 @@ def export_kml(relationId): ...@@ -205,8 +205,9 @@ def export_kml(relationId):
# "imageName": "tom@qq.com", # "imageName": "tom@qq.com",
# "labelList": [ # "labelList": [
# { # {
# "labelId": 123, # "labelId": 456,
# "labelName": "标注", # "labelName": "标注",
# "correct": 0,
# "pointList": [ # "pointList": [
# { # {
# "pointId": 14, # "pointId": 14,
...@@ -216,23 +217,6 @@ def export_kml(relationId): ...@@ -216,23 +217,6 @@ def export_kml(relationId):
# ] # ]
# } # }
# ] # ]
# },
# {
# "relationId": 156,
# "imageName": "jerry@qq.com",
# "labelList": [
# {
# "labelId": 13,
# "labelName": "标注",
# "pointList": [
# {
# "pointId": 145,
# "X": 2.834,
# "Y": 145
# }
# ]
# }
# ]
# } # }
# ] # ]
# } # }
...@@ -245,6 +229,7 @@ def export_kml(relationId): ...@@ -245,6 +229,7 @@ def export_kml(relationId):
# { # {
# "labelId": 181, # "labelId": 181,
# "labelName": "label01", # "labelName": "label01",
# "correct": 0,
# "pointList": [ # "pointList": [
# { # {
# "pointId": 21, # "pointId": 21,
...@@ -261,6 +246,7 @@ def export_kml(relationId): ...@@ -261,6 +246,7 @@ def export_kml(relationId):
# { # {
# "landmarkId": 31, # "landmarkId": 31,
# "landmarkName": "landmark31", # "landmarkName": "landmark31",
# "correct": 0,
# "X": 31.1, # "X": 31.1,
# "Y": 31.2 # "Y": 31.2
# } # }
......
...@@ -190,7 +190,18 @@ def getFileContent(): ...@@ -190,7 +190,18 @@ def getFileContent():
return json.dumps(return_dict, ensure_ascii=False) return json.dumps(return_dict, ensure_ascii=False)
url = result.get('textUrl') url = result.get('textUrl')
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r', encoding='UTF-8').read() try:
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r', encoding='utf-8').read()
except Exception as e:
try:
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r', encoding='utf-16').read()
except Exception as e:
try:
fileStr = open(os.path.join(basedir, UPLOAD_FOLDER, url), 'r').read()
except Exception as e:
return_dict['return_code'] = '203'
return_dict['return_info'] = '该编码的文本文法打开'
return json.dumps(return_dict, ensure_ascii=False)
# 后端传给前端 return_dict = {'return_code': '200', 'return_info': '处理成功', 'result': fileStr} # 后端传给前端 return_dict = {'return_code': '200', 'return_info': '处理成功', 'result': fileStr}
return_dict['result'] = fileStr return_dict['result'] = fileStr
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment