error in shape net dataloader #542
krrishnakumarkp75
started this conversation in
General
Replies: 1 comment
-
Helo! In my case it's ok this way in this same directory I also copied the shapenet_synset_dict_v1 file. I am using Colab. Hope this helps. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When i try to execute the following line
if torch.cuda.is_available():
device = torch.device("cuda:0")
torch.cuda.set_device(device)
else:
device = torch.device("cpu")
SHAPENET_PATH = '/home/ShapeNetCore'
shapenet_dataset = ShapeNetCore(SHAPENET_PATH)
the following error is coming
JSONDecodeError Traceback (most recent call last)
in
6
7 SHAPENET_PATH = '/home/ShapeNetCore'
----> 8 shapenet_dataset = ShapeNetCore(SHAPENET_PATH)
~/anaconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/datasets/shapenet/shapenet_core.py in init(self, data_dir, synsets, version, load_textures, texture_resolution)
63 dict_file = "shapenet_synset_dict_v%d.json" % version
64 with open(path.join(SYNSET_DICT_DIR, dict_file), "r") as read_dict:
---> 65 self.synset_dict = json.load(read_dict)
66 # Inverse dicitonary mapping synset labels to corresponding offsets.
67 self.synset_inv = {label: offset for offset, label in self.synset_dict.items()}
~/anaconda3/envs/pytorch3d/lib/python3.8/json/init.py in load(fp, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
291 kwarg; otherwise
JSONDecoder
is used.292 """
--> 293 return loads(fp.read(),
294 cls=cls, object_hook=object_hook,
295 parse_float=parse_float, parse_int=parse_int,
~/anaconda3/envs/pytorch3d/lib/python3.8/json/init.py in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
355 parse_int is None and parse_float is None and
356 parse_constant is None and object_pairs_hook is None and not kw):
--> 357 return _default_decoder.decode(s)
358 if cls is None:
359 cls = JSONDecoder
~/anaconda3/envs/pytorch3d/lib/python3.8/json/decoder.py in decode(self, s, _w)
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()
339 if end != len(s):
~/anaconda3/envs/pytorch3d/lib/python3.8/json/decoder.py in raw_decode(self, s, idx)
353 obj, end = self.scan_once(s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end
JSONDecodeError: Expecting value: line 7 column 1 (char 6)
If some one could help me on how to solve this error it would of great help
Thanks in advance
the full jupyter notebook is like this
import os
import sys
import torch
import json
import pytorch3d
import numpy as np
from pytorch3d.datasets import (
R2N2,
ShapeNetCore,
collate_batched_meshes,
render_cubified_voxels,
)
from pytorch3d.renderer import (
OpenGLPerspectiveCameras,
PointLights,
RasterizationSettings,
TexturesVertex,
look_at_view_transform,
)
from pytorch3d.structures import Meshes
from torch.utils.data import DataLoader
add path for demo utils functions
import sys
import os
sys.path.append(os.path.abspath(''))
from pytorch3d.datasets import (
R2N2,
ShapeNetCore,
collate_batched_meshes,
render_cubified_voxels,
)
from pytorch3d.renderer import (
OpenGLPerspectiveCameras,
PointLights,
RasterizationSettings,
TexturesVertex,
look_at_view_transform,
)
from pytorch3d.structures import Meshes
from torch.utils.data import DataLoader
add path for demo utils functions
import sys
import os
sys.path.append(os.path.abspath(''))
!wget https://raw.githubusercontent.com/facebookresearch/pytorch3d/master/docs/tutorials/utils/plot_image_grid.py
from plot_image_grid import image_grid
from pytorch3d.utils import all
import bz2
from pytorch3d.datasets import ShapeNetCore
if torch.cuda.is_available():
device = torch.device("cuda:0")
torch.cuda.set_device(device)
else:
device = torch.device("cpu")
SHAPENET_PATH = '/home/ShapeNetCore'
shapenet_dataset = ShapeNetCore(SHAPENET_PATH)
error come after this--
Beta Was this translation helpful? Give feedback.
All reactions