github源码:
git clone https://github.com/WenmuZhou/PSENet.pytorch
git clone https://gitee.com/zhou_rx/PSENet.pytorch.git
pip install Polygon3,pip install colorlog
数据格式:
训练:
python train.py
问题:
PSENet.pytorch/pse$ make
......
g++: error: unrecognized command line option ‘-fno-plt’
Makefile:10: recipe for target 'pse.so' failed
make: *** [pse.so] Error 1
解决方法:
https://blog.csdn.net/forest_world/article/details/105883339
测试(需要继续训练和调参):
def draw_bbox(img_path, result, color=(255, 0, 0),thickness=2):
if isinstance(img_path, str):
img_path = cv2.imread(img_path)
# img_path = cv2.cvtColor(img_path, cv2.COLOR_BGR2RGB)
img_path = img_path.copy()
for point in result:
point = point.astype(int)
cv2.line(img_path, tuple(point[0]), tuple(point[1]), (0, 0, 255), thickness)
cv2.line(img_path, tuple(point[1]), tuple(point[2]), (0, 255, 0), thickness)
cv2.line(img_path, tuple(point[2]), tuple(point[3]), (255, 0, 0), thickness)
cv2.line(img_path, tuple(point[3]), tuple(point[0]), (0, 0, 0), thickness)
return img_path
测试图片来源百度