Communicate in Chinese!中文交流!
i4yyds opened this issue · 11 comments
去他娘的英文!
我对代码中的loss层有4个疑问,目前已经解决3个。分享一些自己的观点,一起交流!
- 为什么使用 offset ?
- 为什么对 w和h 开根号 ?
- 为什么使用 offset_tran ?
- 四个loss的含义 ?
confidence loss :
- A = 有物体的格子 * (预测 - IOU) #目的是让A减小,即预测=IOU
- B = 没有物体的格子 * 预测 #目的是让B减小,即没有物体的格子预测值为0
class loss:
C = 有物体的格子 * (预测 - 真实值) #目的是让C减小,即预测=真实值
box loss:
D = 有物体的格子 * (预测[位移x,位移y, w比例,h比例] - 真实[位移x,位移y, w比例,h比例]) #目的使得预测=真实
D说明:一张图片被划分为7x7个格子,yolo_net输出的是每个格子的4个值,四个分别为:相对每个格子左上角的偏移量x和y,相对原始图片长和宽的比例w和h。因此offset=[[0,0],[1,1],...,[6,6]],的目的是让每个格子的偏移量x和y映射到原始图片的位置。比如第2行第1列的格子x=22,y=33。则2和1由offset表示,xy代表偏移量,就可以算出目标在原始图片中的位置。
为什么 读数据 没用到xml文件
为什么 读数据 没用到xml文件
用到了 /utils/pascal_voc.py 中的load_pascal_annotation函数
请问,如何训练自己的数据?数据集也用labelimage做成了VOC格式放入了相应的位置, 我从零开始训练时,出现问题
ValueError:Cannot feed value of shape (45,7,7,25) for tensor 'placeholder:0' ,which has shape '(?,7,7,9)'
我仔细检查了能够训练的VOC2007数据 feed_dict
images.shape={45,448,448,3}
labels.shape={45,7,7,25}
而换成我自己的数据训练时,shape也是一致的,这样来看数据接口是没有啥问题了,不知道问题出现在哪里呢?
根据源代码,yolo_net.py中
self.labels = tf.placeholder( tf.float32, [None, self.cell_size, self.cell_size, 5 + self.num_class])
我所使用的数据是四类,最后一维为9,而VOC2007数据类别为20类,故为25,应该是标签数据这块有误,还得好好看看。
pascal_voc.py文件中,
第一处
def get(self): images = np.zeros( (self.batch_size, self.image_size, self.image_size, 3)) labels = np.zeros( (self.batch_size, self.cell_size, self.cell_size, 25))
第二处
def load_pascal_annotation(self, index): imname = os.path.join(self.data_path, 'JPEGImages', index + '.jpg') im = cv2.imread(imname) h_ratio = 1.0 * self.image_size / im.shape[0] w_ratio = 1.0 * self.image_size / im.shape[1] # im = cv2.resize(im, [self.image_size, self.image_size]) label = np.zeros((self.cell_size, self.cell_size, 25))
这两处地方被固定地写为25,而我需要的是9,将其改为9,训练程序成功执行。
你好,我还是不是很理解你对offset的解释,能说的在详细一点么?谢谢
请问,如何训练自己的数据?数据集也用labelimage做成了VOC格式放入了相应的位置, 我从零开始训练时,出现问题
ValueError:Cannot feed value of shape (45,7,7,25) for tensor 'placeholder:0' ,which has shape '(?,7,7,9)'
我仔细检查了能够训练的VOC2007数据 feed_dict
images.shape={45,448,448,3}
labels.shape={45,7,7,25}
而换成我自己的数据训练时,shape也是一致的,这样来看数据接口是没有啥问题了,不知道问题出现在哪里呢?
根据源代码,yolo_net.py中
self.labels = tf.placeholder( tf.float32, [None, self.cell_size, self.cell_size, 5 + self.num_class])
我所使用的数据是四类,最后一维为9,而VOC2007数据类别为20类,故为25,应该是标签数据这块有误,还得好好看看。
pascal_voc.py文件中,
第一处
def get(self): images = np.zeros( (self.batch_size, self.image_size, self.image_size, 3)) labels = np.zeros( (self.batch_size, self.cell_size, self.cell_size, 25))
第二处
def load_pascal_annotation(self, index): imname = os.path.join(self.data_path, 'JPEGImages', index + '.jpg') im = cv2.imread(imname) h_ratio = 1.0 * self.image_size / im.shape[0] w_ratio = 1.0 * self.image_size / im.shape[1] # im = cv2.resize(im, [self.image_size, self.image_size]) label = np.zeros((self.cell_size, self.cell_size, 25))
这两处地方被固定地写为25,而我需要的是9,将其改为9,训练程序成功执行。
那请问 你 有没有加载 原来的权重?
请问,如何训练自己的数据?数据集也用labelimage做成了VOC格式放入了相应的位置, 我从零开始训练时,出现问题
ValueError:Cannot feed value of shape (45,7,7,25) for tensor 'placeholder:0' ,which has shape '(?,7,7,9)'
我仔细检查了能够训练的VOC2007数据 feed_dict
images.shape={45,448,448,3}
labels.shape={45,7,7,25}
而换成我自己的数据训练时,shape也是一致的,这样来看数据接口是没有啥问题了,不知道问题出现在哪里呢?
根据源代码,yolo_net.py中
self.labels = tf.placeholder( tf.float32, [None, self.cell_size, self.cell_size, 5 + self.num_class])
我所使用的数据是四类,最后一维为9,而VOC2007数据类别为20类,故为25,应该是标签数据这块有误,还得好好看看。
pascal_voc.py文件中,
第一处
def get(self): images = np.zeros( (self.batch_size, self.image_size, self.image_size, 3)) labels = np.zeros( (self.batch_size, self.cell_size, self.cell_size, 25))
第二处
def load_pascal_annotation(self, index): imname = os.path.join(self.data_path, 'JPEGImages', index + '.jpg') im = cv2.imread(imname) h_ratio = 1.0 * self.image_size / im.shape[0] w_ratio = 1.0 * self.image_size / im.shape[1] # im = cv2.resize(im, [self.image_size, self.image_size]) label = np.zeros((self.cell_size, self.cell_size, 25))
这两处地方被固定地写为25,而我需要的是9,将其改为9,训练程序成功执行。那请问 你 有没有加载 原来的权重?
有,恢复模型时不要恢复输出层的权重就好,其他层权重就用原来的再进行训练。
请问,如何训练自己的数据?数据集也用labelimage做成了VOC格式放入了相应的位置, 我从零开始训练时,出现问题
ValueError:Cannot feed value of shape (45,7,7,25) for tensor 'placeholder:0' ,which has shape '(?,7,7,9)'
我仔细检查了能够训练的VOC2007数据 feed_dict
images.shape={45,448,448,3}
labels.shape={45,7,7,25}
而换成我自己的数据训练时,shape也是一致的,这样来看数据接口是没有啥问题了,不知道问题出现在哪里呢?
根据源代码,yolo_net.py中
self.labels = tf.placeholder( tf.float32, [None, self.cell_size, self.cell_size, 5 + self.num_class])
我所使用的数据是四类,最后一维为9,而VOC2007数据类别为20类,故为25,应该是标签数据这块有误,还得好好看看。
pascal_voc.py文件中,
第一处
def get(self): images = np.zeros( (self.batch_size, self.image_size, self.image_size, 3)) labels = np.zeros( (self.batch_size, self.cell_size, self.cell_size, 25))
第二处
def load_pascal_annotation(self, index): imname = os.path.join(self.data_path, 'JPEGImages', index + '.jpg') im = cv2.imread(imname) h_ratio = 1.0 * self.image_size / im.shape[0] w_ratio = 1.0 * self.image_size / im.shape[1] # im = cv2.resize(im, [self.image_size, self.image_size]) label = np.zeros((self.cell_size, self.cell_size, 25))
这两处地方被固定地写为25,而我需要的是9,将其改为9,训练程序成功执行。那请问 你 有没有加载 原来的权重?
有,恢复模型时不要恢复输出层的权重就好,其他层权重就用原来的再进行训练。
我也尝试这样加载,就最后一层的权重不加载。但是这样的损失值和不加载差距不大。因此我不是很确定我是否加载成功。还是这样加载,损失就是很大。下面是我对应的程序。不知道你的这部分程序如何写的。如果可以,方便发我一下吗?QQ:837006859 , 微信: zhuhui-zhuhui 。姓名:朱辉
variables_to_restore = tf.contrib.framework.get_variables_to_restore(
exclude=['yolo/fc_36', 'global_step'])
init_fn = tf.contrib.framework.assign_from_checkpoint_fn(self.weights_file,
variables_to_restore)
fc3_variables = tf.contrib.framework.get_variables('yolo/fc_36')
fc3_init = tf.variables_initializer(fc3_variables)
init_fn(self.sess)
self.sess.run(fc3_init)
去他娘的英文!
我对代码中的loss层有4个疑问,目前已经解决3个。分享一些自己的观点,一起交流!
- 为什么使用 offset ?
- 为什么对 w和h 开根号 ?
- 为什么使用 offset_tran ?
- 四个loss的含义 ?
为什么开根号你认真的吗,读过论文吗?
去他娘的英文!
我对代码中的loss层有4个疑问,目前已经解决3个。分享一些自己的观点,一起交流!
- 为什么使用 offset ?
- 为什么对 w和h 开根号 ?
- 为什么使用 offset_tran ?
- 四个loss的含义 ?
为什么开根号你认真的吗,读过论文吗?
@liujiahao11 注意言辞,不要太激进
https://arxiv.org/pdf/1506.02640.pdf
第四面公式(3)
无论是否加载YOLO-small.ckpt,训练出来的模型都无法检测到任何物体。
No matter if I use the pretrained model Yolo-small.ckpt, no thing can be detected with the model I trained by myself.