cheerss / pixellink-with-pytorch Goto Github PK
View Code? Open in Web Editor NEWPixelLink-with-pytorch
PixelLink-with-pytorch
我跑了ICDAR2015数据集,loss一般在05左右,降不下去了,训练集上测试效果几乎没效果,请问是还没有收敛吗?
In datasets.py line 351: "label = sample['label'].reshape([-1, 4, 2])", should be changed to "label = np.array(sample['label']['coor']).reshape([-1, 4, 2])".
Because sample['label'] is dict type, and it only need coordinates to draw the contours.
自己的数据集,修改好训练,报这个错,有大神遇到吗?
raise RuntimeError('each element in list of batch should be of equal size')
RuntimeError: each element in list of batch should be of equal size
where to download best accuaracy model? 哪里下载最佳模型?
hello,
Thanks for your sharing, I modify your code to complete my task based on pytorch. After fininshed my training process to test, it appears an error which is "IndexError: index 2 is out of bounds for dimension 0 with size 2"
Traceback (most recent call last):
File "main.py", line 184, in
test_model()
File "main.py", line 51, in test_model
all_boxes = postprocess.mask_to_box(out_1, out_2)
File "/home/liuchao/PixelLink-with-pytorch/postprocess.py", line 59, in mask_to_box
link_neighbors[:, i] = link_neighbors[:, i] & pixel_class[i]
IndexError: index 2 is out of bounds for dimension 0 with size 2
I'm grateful for u to help me solve the error above,Thanks~
File "main.py", line 138, in
main()
File "main.py", line 128, in main
train(config.epoch, iteration, dataloader, my_net, optimizer, optimizer2, device)
File "main.py", line 59, in train
for i_batch, sample in enumerate(dataloader):
File "/home/denny/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 317, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/denny/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 317, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/home/denny/github_open_Sources/PixelLink-with-pytorch/datasets.py", line 84, in getitem
image, label = self.train_data_transform(index)
File "/home/denny/github_open_Sources/PixelLink-with-pytorch/datasets.py", line 103, in train_data_transform
img = self.read_image(self.images_dir, index)
File "/home/denny/github_open_Sources/PixelLink-with-pytorch/datasets.py", line 34, in read_image
image = ImgTransform.ReadImage(filename)
File "/home/denny/github_open_Sources/PixelLink-with-pytorch/ImgLib/ImgTransform.py", line 16, in ReadImage
with Image.open(filename) as img:
File "/home/denny/anaconda3/envs/pytorch/lib/python3.6/site-packages/PIL/Image.py", line 2609, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'training_images/images/img_tensor(956).jpg'
hello, thanks for your codes and am interested in it..
As you said this version is still under developing, is there any new updates?
I didn't find the functions for testing and this version can only train IC15 dataset, right?
When will you upload new codes...really looking forward your reply.
Thanks again!!
我改了数据加载这里,看了下没啥问题,为啥会爆炸呢?请指教一下
reade_label()
with codecs.open(os.path.join(dir, self.labels_name[i-1]), encoding="utf-8_sig") as file:
data = file.readlines()
temp_str = ''
for l in data:
temp_str += l.strip('\r\n')
temp_json = json.loads(temp_str)
tmp = {}
tmp["coor"] = []
tmp["content"] = []
tmp["ignore"] = []
tmp["area"] = []
for line in temp_json["shapes"]:
tmp["content"].append(line["label"])
if line["label"] == "###":
tmp["ignore"].append(True)
else:
tmp["ignore"].append(False)
coor = []
if len(line["points"]) != 4:
print(os.path.join(dir, self.labels_name[i - 1]))
print(line["points"])
for n in line["points"]:
coor.append(int(n[0]))
coor.append(int(n[1]))
tmp["coor"].append(coor)
coor = np.array(coor).reshape([4, 2])
tmp["area"].append(cv2.contourArea(coor))
# for line in data:
# content = line.split(",")
# coor = [int(n) for n in content[:8]]
#
# content[8] = content[8].strip("\r\n")
# tmp["content"].append(content[8])
# if content[8] == "###":
# tmp["ignore"].append(True)
# else:
# tmp["ignore"].append(False)
# coor = np.array(coor).reshape([4,2])
# tmp["area"].append(cv2.contourArea(coor))
res[i-1] = tmp
return res
另外,请问加载图像时index为什么加1,我把加1去掉了?
filename = os.path.join(dir, self.images_name[index] + ".jpg")
postprocess.py line 89:128 should be changed to 256.
Sorry but where can I download the pretrained model, or which version do I need?
when I train this model, it happened this situation. And I have a RTX 1080 Ti with 12GB memory.
File "/workspace/PixelLink-with-pytorch/main.py", line 144, in
main()
File "/workspace/PixelLink-with-pytorch/main.py", line 133, in main
train(config.epoch, iteration, dataloader, my_net, optimizer, optimizer2, device)
File "/workspace/PixelLink-with-pytorch/main.py", line 73, in train
pixel_pos_weights)
File "/workspace/PixelLink-with-pytorch/criterion.py", line 46, in pixel_loss
self.neg_pixel_weight[i] = self.neg_pixel_weight[i] & (neg_pixel_masks[i]==1)
RuntimeError: Expected object of scalar type Byte but got scalar type Bool for argument #2 'other' in call to _th_and
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.