You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.7KB

  1. # -*- coding: utf-8 -*-
  2. import sys
  3. sys.path.extend(['..', '../AIlib'])
  4. from segutils.segmodel import SegModel, get_largest_contours
  5. from utils.torch_utils import select_device
  6. from models.experimental import attempt_load
  7. from utilsK.queRiver import get_labelnames, get_label_arrays, post_process_
  8. from AI import AI_process, AI_process_forest, get_postProcess_para
  9. class ModelConfig():
  10. def __init__(self):
  11. postFile = '../AIlib/conf/para.json'
  12. self.conf_thres, self.iou_thres, self.classes, self.rainbows = get_postProcess_para(postFile)
  13. class SZModelConfig(ModelConfig):
  14. def __init__(self):
  15. super(SZModelConfig, self).__init__()
  16. labelnames = "../AIlib/weights/yolov5/class8/labelnames.json" ##对应类别表
  17. self.names = get_labelnames(labelnames)
  18. self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=40,
  19. fontpath="../AIlib/conf/platech.ttf")
  20. class LCModelConfig(ModelConfig):
  21. def __init__(self):
  22. super(LCModelConfig, self).__init__()
  23. labelnames = "../AIlib/weights/forest/labelnames.json"
  24. self.names = get_labelnames(labelnames)
  25. self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=40, fontpath="../AIlib/conf/platech.ttf")
  26. class RFModelConfig(ModelConfig):
  27. def __init__(self):
  28. super(RFModelConfig, self).__init__()
  29. labelnames = "../AIlib/weights/road/labelnames.json"
  30. self.names = get_labelnames(labelnames)
  31. imageW = 1536
  32. outfontsize=int(imageW/1920*40)
  33. self.label_arraylist = get_label_arrays(self.names, self.rainbows, outfontsize=outfontsize, fontpath="../AIlib/conf/platech.ttf")