Comments (3)
标签文件的内容是下面的格式,标签,中心点坐标(cx,cy),宽,高
1 0.48652694610778446 0.7020000000000001 0.5538922155688623 0.596
14 0.5179640718562875 0.463 0.592814371257485 0.922
14 0.877245508982036 0.506 0.24550898203592816 0.936
make_target函数只是一个提取的示例,实际解析使用的data/voc.py的__getitem__函数解析xml得到。
from pytorch_yolov1.
对,我看到了那个解析XML,也是[x1,y1,x2,y2]
def _get_annotation(self, image_id): annotation_file = image_id objects = ET.parse(annotation_file).findall("object") boxes = [] labels = [] is_difficult = [] for obj in objects: class_name = obj.find('name').text.lower().strip() bbox = obj.find('bndbox') # VOC dataset format follows Matlab, in which indexes start from 0 x1 = float(bbox.find('xmin').text) - 1 y1 = float(bbox.find('ymin').text) - 1 x2 = float(bbox.find('xmax').text) - 1 y2 = float(bbox.find('ymax').text) - 1 boxes.append([x1, y1, x2, y2])
然后 接下来就是两个变换,其中没有看到涉及您说的那个标签文件,self.transform 这一步,box 的格式也没有变化,而在self.target_transform 这里使用的就是[Cx, Cy, w, h] ,所以我就很疑惑。
` def getitem(self, index):
image_id = self.ids[index]
# gt 框 boxes [x1, y1, x2, y2]
boxes, labels, is_difficult = self._get_annotation(image_id) #
if not self.keep_difficult:
boxes = boxes[is_difficult == 0]
labels = labels[is_difficult == 0]
image = self._read_image(image_id)
if self.transform:
image, boxes, labels = self.transform(image, boxes, labels) #
boxes = np.clip(boxes, 0.0, 1.0)
if self.target_transform:
image, targets = self.target_transform(image, boxes, labels) #
return image, targets, image_id
return image, boxes, labels`
from pytorch_yolov1.
我扫了一眼 好像是有问题,我修改了代码,现在没时间验证难怪当时效果不好😅
from pytorch_yolov1.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch_yolov1.