Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

simclr on medical dataset gives error #187

Open
fatmacelebi opened this issue Jan 24, 2022 · 7 comments
Open

simclr on medical dataset gives error #187

fatmacelebi opened this issue Jan 24, 2022 · 7 comments

Comments

@fatmacelebi
Copy link

I just changed the line 65 in simclr/tf2/data.py ( dataset = builder.as_dataset() ) as
dataset= tf.data.Dataset.from_tensor_slices(train_images)
but I was not able to run the codes. Is there any document that you can share with me how to apply simclr on custom dataset which different than tensorflow dataset or can you say where I am doing wrong?
In my codes; train_images = list(paths.list_images(images_path))
images_path=folder path which contains unlabaled pretraining images
With this way I am getting error in mp_fn function with error "tf__map_fn() missing 1 required positional argument: 'label'"

@ambekarsameer96
Copy link

ambekarsameer96 commented Jan 27, 2022

Hi, you can try to add labels from the dataset, that might fix the issue. You can refer to this from -
https://www.tensorflow.org/api_docs/python/tf/data/Dataset

# Both the features and the labels tensors can be converted to a Dataset object separately and combined after. features_dataset = Dataset.from_tensor_slices(features) labels_dataset = Dataset.from_tensor_slices(labels) dataset = Dataset.zip((features_dataset, labels_dataset))

@fatmacelebi
Copy link
Author

but I don't have any label, because I want to train unlabeled images as pretraining.

@chentingpc
Copy link
Contributor

creating a dummy label may suffice. label won't be used anyway for the pretraining of backbone network.

@fatmacelebi
Copy link
Author

Finally, I was able to run the code, but after completing the iteartions I couldn't get any hub file which has saved model like in your case, and code just cerated files like ;

  • checkpoint
  • model.ckpt-8720.data-00000-of-00001
  • model.ckpt-8720.index
  • model.ckpt-8720.meta

and I don't know from above files which can be used as model for fine-tuning? Am I doing wrong while running and because of that the code doesn't create any hub file with saved model?
Can you help please?

@chentingpc
Copy link
Contributor

chentingpc commented Feb 9, 2022 via email

@fatmacelebi
Copy link
Author

I need Resnet model pre-trained weights to use in another approach as initial weights and I need an .h5 file to load weights. Is is possible to get such a file?

@wmrenr
Copy link

wmrenr commented Jan 4, 2023

apply simclr on custom dataset

Now I want apply simclr on my custom dataset.Could you please tell me how to prepare datas format?Thank you very much!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants