深度學習訓練需要標記映像位置和類別,之前用的時候是叫做BBox-Label-Tool-master,遇到大映像就顯示不完整了,沒有自適應縮放, 這是改進後的Python指令碼。
目錄結構:圖片目錄名images, 標籤目錄名labels,映像目錄下各類別目錄名要以001,002,003,...的格式命名。
這是運行labelTool ( python main.py)時的截屏,映像框記錄的是比例值,
快速鍵a,d前後切換映像,esc取消當前框
python指令碼main.py:
[python] view plain copy # -*- coding:utf-8 -*- #------------------------------------------------------------------------------- # Name: Object bounding box label tool # Purpose: Label object bboxes for ImageNet Detection data # Author: Qiushi # Created: 06/06/2014 # #------------------------------------------------------------------------------- from __future__ import division from Tkinter import * import tkMessageBox from PIL import Image, ImageTk import os import glob import random w0 = 1; #圖片原始寬度 h0 = 1; #圖片原始高度 # colors for the bboxes COLORS = ['red', 'blue', 'yellow', 'pink', 'cyan', 'green', 'black'] # image sizes for the examples SIZE = 256, 256 #指定縮放後的映像大小 DEST_SIZE = 500, 500 class LabelTool(): def __init__(self, master): # set up the main frame self.parent = master self.parent.title("LabelTool") self.frame = Frame(self.parent) self.frame.pack(fill=BOTH, expand=1) self.parent.resizable(width = TRUE, height = TRUE) # initialize global state