facebookresearch / Active-3D-Vision-and-Touch

A repository for the paper Active 3D Shape Reconstruction from Vision and Touch and robotic touch simulator package.
MIT License
25 stars 9 forks source link

Directory not found error #2

Closed fz920 closed 2 years ago

fz920 commented 2 years ago

Thanks for sharing your code.

When I was trying to run the DDQN notebook in notebook/Policies/DDQN.ipynb, I kept getting the following error, FileNotFoundError: [Errno 2] No such file or directory: '/private/home/ejsmith/projects/active/ActiveTouch/pterotactyl/reconstruction/touch/experiments/checkpoint/touch_train/touch_27/model'

Here is the traceback for this error: FileNotFoundError Traceback (most recent call last) in 44 params = Params() 45 ddqn_trainer = ddqn_train.Engine(params) ---> 46 ddqn_trainer()

5 frames /content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/policies/DDQN/train.py in call(self) 44 def call(self): 45 # initialize the learning environment ---> 46 self.env = environment.ActiveTouch(self.args) 47 self.replay_memory = replay.ReplayMemory(self.args) 48 self.policy = ddqn.DDQN(self.args, self.env.mesh_info, self.replay_memory)

/content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/policies/environment.py in init(self, args) 34 ) 35 self.pretrained_recon_models() ---> 36 self.setup_recon() 37 self.get_loaders() 38 self.sampler = sampler.Sampler(

/content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/policies/environment.py in setup_recon(self) 111 touch_args, weights = utils.load_model_config(self.args.touch_location) 112 self.touch_prediction = touch_model.Encoder().cuda() --> 113 self.touch_prediction.load_state_dict(torch.load(weights)) 114 self.touch_prediction.eval() 115

/usr/local/lib/python3.7/dist-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args) 697 pickle_load_args['encoding'] = 'utf-8' 698 --> 699 with _open_file_like(f, 'rb') as opened_file: 700 if _is_zipfile(opened_file): 701 # The zipfile reader is going to advance the current file position.

/usr/local/lib/python3.7/dist-packages/torch/serialization.py in _open_file_like(name_or_buffer, mode) 228 def _open_file_like(name_or_buffer, mode): 229 if _is_path(name_or_buffer): --> 230 return _open_file(name_or_buffer, mode) 231 else: 232 if 'w' in mode:

/usr/local/lib/python3.7/dist-packages/torch/serialization.py in init(self, name, mode) 209 class _open_file(_opener): 210 def init(self, name, mode): --> 211 super(_open_file, self).init(open(name, mode)) 212 213 def exit(self, *args):

I tried to understand this error and ran the following code args, weight_location = load_model_config(os.path.dirname(pretrained.__file__) + "/reconstruction/touch/best/") print(weight_location) And the output is the directory which seems strange to me. '/private/home/ejsmith/projects/active/ActiveTouch/pterotactyl/reconstruction/touch/experiments/checkpoint/touch_train/touch_27/model' Please could you help with this issue?

Thanks in advance!

EdwardSmith1884 commented 2 years ago

Hi , I have found the issue, this was an oversight on my part. I will try to upload a fix this weekend. For now I would say run without the pretrained setting. If this is time sensitive, let me know and I will get it out quicker. Thanks for letting me know !

fz920 commented 2 years ago

Thanks for your quick response and suggestion. This is not time-sensitive, so feel free to fix this at your convenience.

fz920 commented 2 years ago

By the way, I have looked at the .urdf file from the data that I downloaded, and I found the following information

`

  <geometry>
    <mesh filename="/private/home/ejsmith/projects/active/ActiveTouch/pterotactyl/object_data/object_info/26766.obj" scale="1 1 1" />
  </geometry>
   <material name="red">
    <color rgba="1 0.4 0.4 1" />
  </material>`

Maybe this mesh filename="/private/home/ejsmith/projects/active/ActiveTouch/pterotactyl/object_data/object_info/26766.obj" should also be changed?

EdwardSmith1884 commented 2 years ago

Thank you! All these absolute file paths are a huge oversight. I am working on this rn, should push by today or tomorrow.

EdwardSmith1884 commented 2 years ago

@fz920 I think I have fixed the issue, can you try again and let me know how it goes? for the mesh objects the path should not be a problem, but if it is please let me know as well. Thanks!

fz920 commented 2 years ago

@fz920 I think I have fixed the issue, can you try again and let me know how it goes? for the mesh objects the path should not be a problem, but if it is please let me know as well. Thanks!

I think I still have the same error caused by the wrong directory name. Could this error be caused by the wrong check_point in the pre-trained model? For example, here is the config.json from one pre-trained model that I downloaded today.

{ "cut": 0.33, "limit_data": false, "finger": false, "touch_location": "../touch/experiments/checkpoint/touch_train/touch_20", "vision_location": "../vision/experiments/checkpoint/vision_train/t_g_34/", "number_points": 30000, "encoding_size": 100, "seed": 0, "lr": 0.0003, "eval": false, "batch_size": 16, "val_grasps": -1, "exp_id": "t_g_4", "exp_type": "auto_train", "use_img": false, "use_touch": true, "patience": 70, "loss_coeff": 9000.0, "num_CNN_blocks": 6, "layers_per_block": 3, "CNN_ker_size": 5, "num_GCN_layers": 5, "hidden_GCN_size": 400, "num_grasps": 5, "debug": false, "epochs": 1000, "check_point": "/private/home/ejsmith/projects/active/ActiveTouch/pterotactyl/reconstruction/autoencoder/experiments/checkpoint/auto_train/t_g_4" }

EdwardSmith1884 commented 2 years ago

Hi I made it so the location always points to the pre-trained model now I think. Are you sure you pulled and reinstalled the package? This checkpoint location should not be being used anywhere : https://github.com/facebookresearch/Active-3D-Vision-and-Touch/blob/c10da8f94491d6c9bbe55121dccb2e7faa543cfd/pterotactyl/policies/environment.py#L112 . If this problem still persists can you send me the error as you see it again?

fz920 commented 2 years ago

Thanks a lot for helping with this. I have reinstalled the package, and that error has been fixed. But now I have the following error:


error                                     Traceback (most recent call last)
[<ipython-input-31-24b18025f61c>] in <module>
     43 params = Params()
     44 ddqn_trainer = ddqn_train.Engine(params)
---> 45 ddqn_trainer()

4 frames
[/content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/policies/DDQN/train.py] in __call__(self)
     67         self.resume()
     68         # training loop
---> 69         for epoch in range(self.epoch, self.args.epochs):
     70             self.train(train_loader)
     71             self.env.reset_pybullet()

[/content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/policies/DDQN/train.py] in train(self, dataloader)
    104             if v > self.args.train_steps - 1:
    105                 break
    106 
--> 107             obs = self.env.reset(batch)
    108 

[/content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/policies/environment.py] in reset(self, batch)
    149             [self.args.env_batch_size, self.args.num_actions]
    150         )
--> 151         self.sampler.load_objects(batch["names"], from_dataset=True)
    152         obs = self.compute_obs()
    153         self.current_data["score"] = obs["score"]

[/content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/simulator/scene/sampler.py] in load_objects(self, batch, from_dataset, scale)
     78                 utils.make_urdf(verts, faces, urdf_location)
     79 
---> 80             self.pybullet_scenes[i].load_obj(verts, faces, urdf_location)
     81 
     82     def remove_objects(self):

[/content/gdrive/MyDrive/Active-3D-Vision-and-Touch/pterotactyl/simulator/scene/instance.py] in load_obj(self, verts, faces, urdf_location)
     89         # loading into pybullet
     90         self.obj = self.pb.loadURDF(
---> 91             urdf_location, [0, 0, 0], [0, 0, 0, 1], useFixedBase=1
     92         )
     93 

error: Cannot load URDF file.

Do you think the path of the mesh objects causes this?

EdwardSmith1884 commented 2 years ago

When I run this locally the object location is a relative path. Can you check which location is referenced in urdf_location and see if there if a file there? If not can you check where you saved the data to?

Araik-77 commented 1 year ago

Hi, thank you for your sharing, I have the same problem,

"error: Cannot load URDF file."

I wanna to know whether you have fixed this error and how you fixed it.