Open yunxiaozimeng opened 4 years ago
the image you are trying to load ("datasets/jhc\train\3762.jpg") probably doesnt exist at that path. But thats just guessing as you're not providing any code..
the image you are trying to load ("datasets/jhc\train\3762.jpg") probably doesnt exist at that path. But thats just guessing as you're not providing any code..
I find the image in this path .and when i train next time ,this image is ok but another image which has no problem at the first train has problem.>_<
are the file names always only numbers? any special characters? is this code snippet working
frame = cv2.imread('datasets/jhc\train\3762.jpg')
frame_RGB= cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)
are the file names always only numbers? any special characters? is this code snippet working
frame = cv2.imread('datasets/jhc\train\3762.jpg') frame_RGB= cv2.cvtColor(frame,cv2.COLOR_BGR2RGB) only numbers and capital letters .no special characters .and I have tried to chage the '\' to '/' ,but it didn't work
so is the code snippet above mentioned working? if not whats the error? what exactly did you tried to change? please provide your code
so is the code snippet above mentioned working? if not whats the error? what exactly did you tried to change? please provide your code
it work, no error .and i train again with my change ,but meet the same error with different image def load_image(self, image_index): image_info = self.coco.loadImgs(self.image_ids[image_index])[0]
_path = './datasets/jhc/train/'+ image_info['file_name']_
print(path)
img = cv2.imread(path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return img.astype(np.float32) / 255.
THIS IS THE ERROE
Traceback (most recent call last):
File "train.py", line 327, in
AND WHEN I RUN THE CODE HERE ,IT HAS NO ERROR import cv2 frame = cv2.imread('datasets/jhc/train/d0.jpg') frame_RGB= cv2.cvtColor(frame,cv2.COLOR_BGR2RGB)
Can you try and provide the full path to the images here path = './datasets/jhc/train/'
? It might be a problem as your EffDet runs on drive E:\, your anaconda is fo F:\ and your OpenCV on C:\
Can you try and provide the full path to the images here
path = './datasets/jhc/train/'
? It might be a problem as your EffDet runs on drive E:, your anaconda is fo F:\ and your OpenCV on C:\
IT DOESN'T WORK >_<! THIS IS CODE def load_image(self, image_index): image_info = self.coco.loadImgs(self.image_ids[image_index])[0]
path = 'E:/Yet-Another-EfficientDet-Pytorch-master/datasets/jhc/train/'+ image_info['file_name']
print(path)
img = cv2.imread(path)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
return img.astype(np.float32) / 255.
HERE IS ERROR ,ANOTHER IMAGE :
Traceback (most recent call last):
File "train.py", line 327, in
This function loads your images for training
def load_image(self, image_index):
image_info = self.coco.loadImgs(self.image_ids[image_index])[0]
so you have to give the corrects paths to this function and not just set your path
variable or something.
If you train on windows, you will have to set num_workers to 0
我遇到了同样的问题,请问你解决了吗
我遇到了同样的问题,请问你解决了吗
嗯,解决了 。就是图片和instance_train.json里的图片名称不匹配(少了一张图片),我在4000张图片里找了半天才发现。
哈哈,我也解决了
发自我的iPhone
------------------ Original ------------------ From: yunxiaozimeng <notifications@github.com> Date: Fri, Oct 23, 2020 10:52 PM To: zylo117/Yet-Another-EfficientDet-Pytorch <Yet-Another-EfficientDet-Pytorch@noreply.github.com> Cc: Cleehao <rtbn456@qq.com>, Comment <comment@noreply.github.com> Subject: Re: [zylo117/Yet-Another-EfficientDet-Pytorch] cv2.error (#506)
我遇到了同样的问题,请问你解决了吗
嗯,解决了 。就是图片和instance_train.json里的图片名称不匹配(少了一张图片),我在4000张图片里找了半天才发现。
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
你们不会是下载了同一个坏的数据集吧?不会吧不会吧
这种问题我看都看腻了,因为我和很多人从来没试过,所以觉得挺莫名其妙的
I faced this problem when I renamed the image files in the train and val folders. So they no longer corresponded to the file names in the JSON annotation files.
训练到一半的时候opencv报错cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' 刚开始认为是路径错误,所以在dataset.py里加入了代码“print(path)”然后又训练了一下,想找出是哪张图片路径错误,报错的时候记录了一下报错的图片,又想到可能不止一张,再次训练了一下,结果发现刚才报错的图片又没问题了,没有报错的图片反而报错了。请问这个问题怎么解决? Traceback (most recent call last): File "train.py", line 327, in
datasets/jhc\train\3762.jpg
train(opt)
File "train.py", line 212, in train
for iter, data in enumerate(progress_bar):
File "F:\anaconda3\lib\site-packages\tqdm\std.py", line 1108, in iter
for obj in iterable:
File "F:\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 345, in next
data = self._next_data()
File "F:\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 856, in _next_data
return self._process_data(data)
File "F:\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 881, in _process_data
data.reraise()
File "F:\anaconda3\lib\site-packages\torch_utils.py", line 394, in reraise
raise self.exc_type(msg)
cv2.error: Caught error in DataLoader worker process 3.
Original Traceback (most recent call last):
File "F:\anaconda3\lib\site-packages\torch\utils\data_utils\worker.py", line 178, in _worker_loop
data = fetcher.fetch(index)
File "F:\anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "F:\anaconda3\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "E:\Yet-Another-EfficientDet-Pytorch-master\efficientdet\dataset.py", line 46, in getitem
img = self.load_image(idx)
File "E:\Yet-Another-EfficientDet-Pytorch-master\efficientdet\dataset.py", line 58, in load_image
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
cv2.error: OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empt
y() in function 'cv::cvtColor'