fronay / ceph_xray_keypoints

Try out from-scratch CNN & retrained CNN for cephalometric keypoint detection on skull profile x-ray
14 stars 1 forks source link

toch version #1

Open heixi opened 6 years ago

heixi commented 6 years ago

could you tell me the version of your toch?

fronay commented 6 years ago

This notebook used version 0.3. (Pytorch version 0.4 was released in April, where for instance the "Variable" object was deprecated, in case that causes any issues.)

weiQiangGe commented 6 years ago

I met a problem at line 93 ,"data=torch.from_numpy(np.stack(data))" in function prep_train_loader(img_path), and the error "RuntimeError: can't convert a given np.ndarry to a tensor - it has an invalid type. The only supporterd types are: double, float, int64, int32, and uint8". Thanks

fronay commented 6 years ago

Hi weiQiangGe, perhaps it's due to numpy/pytorch updates since the commit (I was using numpy 1.13.3 & pytorch 0.3 when last updating this, and didn't encounter that error then.)

I think the potentially problematic bit may be using np.stack to concatenate the "data" list of images (which are, themselves, already in torch float tensor format, hence causing a type confusion).

You could try replacing the line torch.from_numpy(np.stack(data)) with torch.stack(data) and see if that fixes it.

However, if you're on pytorch 0.4, there may be further issues later in the script (see my comment on the Variable() object above, which is still in this version as I havent had time to update the entire notebook.)

weiQiangGe commented 6 years ago

I will try this method. Thank you.