I am trying to load 300W_lp dataset in tensorflow.
I downloaded and extracted the dataset manually at C:/datasets/the300w
Now when I try to load dataset into tensorflow using
the300w = tfds.load('the300w_lp',data_dir='C:\datasets\the300w', download=False)
it gives me error
Dataset the300w_lp: could not find data in C:\datasets\the300w. Please make sure to call dataset_builder.download_and_prepare(), or pass download=True to tfds.load() before trying to access the tf.data.Dataset object.
Please help. How to load dataset in tensorflow?
Try to use plain old
dataset = tfds.load('the300w_lp')
It works fine for me. Maybe You somehow incorrectly unzipped the dataset file? If you have spare time, try the above code and see if it works.
Just a simple way to tackle this issue. Simply run the above command in google colab, grab a portion of the dataset object, download it and use it for your own purpose :)
Related
I am trying to train a custom object detector using tflite model maker (https://www.tensorflow.org/lite/tutorials/model_maker_object_detection). I want to deploy trained tflite model to coral edgeTPU. I want to use tensorflow tfrecord (multiple) as input for training a model like object detection API. I tried with
tflite_model_maker.object_detector.DataLoader(
tfrecord_file_patten, size, label_map, annotations_json_file=None
) but I am not able to work around it. I have following questions.
Is it possible to tfrecord for training like mentioned above?
Is it also possible to pass multiple CSV files for training?
For multiple CSV files, you could probably just append one file to the other. Then you'd just have to pass one csv file.
As for passing a tfrecord instead, this should be possible. I'm also attempting to do this, so if I get it working I'll update my post. Looking at the source, it seems from_cache is the function internally used. Following that structure, should be able to create a DataLoader object similarly:
train_data = DataLoader(tfrecord_file_patten, meta_data['size'],
meta_data['label_map'], ann_json_file)
In this case, tfrecord_file_patten should be a tfrecord of your training data. You can construct the validation and test data the same way. This will work provided you're constructing your TFRecords correctly. There appears to be some inconsistency to how it's done in different places, so make sure you follow the same structure in creating the TFRecords as found in the ModelMaker source. This worked for me. One specific thing to watch out for is to use an integer for the 'image/source_id' feature in your TFExamples. If you use a string it'll throw an error.
I'm interested in training a YOLOv5 model. Currently, I'm using Roboflow to annotate and export the data into YOLOv5 format. I'm also using Roboflow's Colab Notebook for YOLOv5.
However, I'm not familiar with many of the commands used in the Roboflow Colab Notebook. I found on here that there appears to be a much more "Pythonic" way of using and manipulating the YOLOv5 model, which I would be much more familiar with.
My questions regarding this are as follows:
Is there an online resource that can show me how to train the YOLOv5 and extract results after importing the model from PyTorch with the "Pythonic" version (perhaps a snippet of code right here on StackOverflow would help)? The official documentation that I could find (here) also uses the "non-Pythonic" method for the model.
Is there any important functionality I would lose if I were to switch to this "Pythonic" method of using YOLOv5?
I found nothing in the documentation that suggests otherwise, but would I need to export my data in a different format from Roboflow for the data to be able to train the "Pythonic" model?
Similar to question 1), is there anywhere that can guide me how to use the trained model on test images? Do I simply do prediction=model(my_image.jpg)? What if I want predictions on multiple images at once?
Any guidance would be appreciated. Thanks!
You can use the GitHub repository of ultralytics to do what you want; if you want to understand the process, check out the train.py file to get a better understanding. There isn't a straightforward explanation you just have to learn by yourself.
For the training: if you want to write the code by yourself it will need a lot of ML knowledge; that's why train.py exist, same for test.py and export.py.
The dataset I have is a bit different and i tried out a few methods. I got the dataset from this website . I desperately need to load the data but I can't. Can anyone help me out with the loading the dataset? I have attached the screenshot of the dataset I downloaded.
dataset = pd.read_csv('yourfilename.csv')
Im super new to tensorflow, and I`m following the tutorials on its webpage.
I already understood the code for the MNIST Dataset tutorial, but I would like to save the model so I can load it afterwards and test it against my own image set.
Im tried many ways of saving it but i keep failing.
Im talking about this tutorial.
Any help will be appreciated!
Edit: Everywhere I go, I see a Session variable, but in this example I dont, and that confuses me...
Do you know how can I save the model from the tutorial and reuse it?
I have a few thousand pictures I want to train a model with tflearn. But somehow I have some problems to prepare the images to the right data format. I tried tflearn.data_utils.image_preloader() but I'm getting a ValueError. So I tried to write my own image_loader.py file, but with so many pictures my RAM is running full.
Does anyone know a good tutorial, example or anything to write a CNN with my own image set, along with details on how to preprocess the data for tflearn?
The Tensorflow tutorial is a good place to start. Preprocessing is covered in this section.