test.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import logging
  2. import os
  3. import random
  4. import cv2
  5. import numpy as np
  6. from image import read_json
  7. # size = np.array([[[500, 501, 502], [600, 601, 602], [100, 101, 102]],
  8. # [[500, 501, 502], [600, 601, 602], [100, 101, 102]],
  9. # [[500, 501, 502], [600, 601, 602], [100, 101, 102]]
  10. # ])
  11. # print(size.shape)
  12. # print(size[..., ::-1])
  13. # img, _, _ = read_json("train/dataset-line/2/train_0.json")
  14. # img.save('train_0.jpg')
  15. # with open('train_463.jpg', 'wb') as f:
  16. # f.write(img)
  17. # print(int(891.999999))
  18. #
  19. # _list = [[1, 2], [2, 3], [3, 4]]
  20. # delete_list = [[1, 2]]
  21. #
  22. # _list.remove(delete_list[0])
  23. # print(_list)
  24. #
  25. # size = (100, 1024)
  26. # image = np.zeros(size[::-1], dtype='uint8')
  27. # cv2.imshow("image", image)
  28. # cv2.waitKey(0)
  29. # image = cv2.imread("8.png")
  30. # ret, binary = cv2.threshold(image, 180, 255, cv2.THRESH_BINARY)
  31. # print("阈值:", ret)
  32. # cv2.imshow("binary", binary)
  33. # cv2.waitKey(0)
  34. # _image = [[1, 0, 1],
  35. # [0, 0, 0]
  36. # ]
  37. # _image = np.array(_image)
  38. # print(np.where(_image >= 1))
  39. # localPath = r"C:\Users\Administrator\Desktop\Test_ODPS\1623857120150.pdf"
  40. # max_file_size_mb = 2
  41. # if os.path.exists(localPath):
  42. # file_size_mb = int(os.path.getsize(localPath)/1024/1024)
  43. # print(file_size_mb)
  44. # if file_size_mb >= max_file_size_mb:
  45. # print("file size > " + str(max_file_size_mb))
  46. # _str = "*" * 10
  47. # print(_str)
  48. print(np.pi / 2)
  49. print(np.arctan(1))
  50. print(random.sample([1, 1, 2], 2))
  51. # from bs4 import BeautifulSoup
  52. # import pandas as pd
  53. # df = pd.read_excel("C:/Users/Administrator/Desktop/pb_screen_increase.xlsx")
  54. # for index, row in df.iterrows():
  55. # df.loc[index, "dochtmlcon"] = str(BeautifulSoup(row["dochtmlcon"]).find("div", id="pcontent"))
  56. # df.to_excel("C:/Users/Administrator/Desktop/pb_screen_increase_new.xlsx", index=False)
  57. dict_stage = {"设计阶段":"设计",
  58. "环评阶段":"环评",
  59. "施工准备":"监理",
  60. "施工在建":"施工"}
  61. list_stage_v = []
  62. for k,v in dict_stage.items():
  63. list_stage_v.append("(?P<%s>%s)"%(k,v))
  64. print("|".join(list_stage_v))