Categories
Misc

save model and load model giving different model.predict results (keras)

My keras model achieved a test accuracy of 98%. I ran model.predict on the test data within the same script and got pretty much the same results. I then tried model.save() and tf.keras.models.load_model() within the same script that I trained in and got the same results with model.predict. But when I load the model in a different script, and then do model.predict on the test data, accuracy is 0%. I have tensorflow 2.7.0. Has this happened for anyone else?

submitted by /u/berimbolo21
[visit reddit] [comments]

Categories
Misc

Is there a way to disable weight decay/regularization for specific weights (e.g. zero-inputs) in tensorflow?

I’m building a tensorflow model which will have some variable sized inputs, with zero (or some other value) padding used to bring smaller inputs up to the standard input size. I also intend to use some sort of weight decay (L1/L2 regularization).

My concern is, that during training whenever padded input comes in, the weights leading out of the zero-inputs will continue to be decayed by whatever regularization I use. Ideally, I would like to disable my L1/L2 regularization on weights that have no gradient due to zero-inputs. Is there a way to get TF to do this? Disabling weight updates on those weights would also work.

If it helps, I can certainly pad with a value that doesn’t appear in the natural data anywhere, so that any occurrence with this value would indicate that weight updates should be masked. The layers will be convolutional.

submitted by /u/Drinniol
[visit reddit] [comments]

Categories
Misc

Help with identifying the right type of model to use

I have a set of images, but I am not working on a classification problem like most tensorflow tutorials have. Rather, I am trying to have the model recognize/develop its own features without a validation set to label and categorize.

I don’t actually know what this type of model is called, so I am having a hard time finding tutorials.

My goal is to have a model that recognizes similarities in new photos and can select them them if they cross a threshold of similarity

submitted by /u/shlotchky
[visit reddit] [comments]

Categories
Misc

How to load an image dataset without my RAM die trying

Hi, I’m new using tensorflow and ML, and I have a question. How can I load a image folder with thousands of imagen with tensorflow? I know that tensorflow can load multiple folders in a directory or categorize data from multiple folders but I only have one folder with that images and I can’t found in the documentation of tensorflow how to load that single folder without convert in ZIP.

I’m sorry if this is a dumb question, but I don’t know how to solve this. Some people told me to load the data with system.os but the RAM don’t support that magnitude of images.

Thank you

submitted by /u/Current_Falcon_3187
[visit reddit] [comments]

Categories
Misc

How to categorize image with Python and Tensorflow?

I am new to using Machine Learning with Tensorflow in CNN. I have a problem, when I try to make a CNN they give me the images in a folder and the labels in a CSV and I don’t know how to categorize the images based on that CSV to then train the model with Tensorflow.

Images are in a single training folder with the names a bit random.

Labels are in CSV that contains two columns: Image name and the associated label.

submitted by /u/Current_Falcon_3187
[visit reddit] [comments]

Categories
Misc

Useful Tools and Resources for Machine Learning

Found a useful list of Tools, Frameworks, and Resources for ML. It covers Machine Learning (TensorFlow/Keras & PyTorch), Core ML, Deep Learning, Computer Vision (CV), and Natural Language Processing (NLP). I thought I’d share it for anyone that’s interested.

submitted by /u/Khaotic_Kernel
[visit reddit] [comments]

Categories
Misc

Most modern way to create dataset for image recognition ? [python]

I want to create a dataset for image recognition but most of the tutorials i could find where really old. Or i just didn’t understand them.

Does anyone have some code wich creates a dataset out of multiple dictionarys (with images in it of) and saves it in a file. (.pickle .npy etc.)

thanks 🙂

submitted by /u/Mo_187_
[visit reddit] [comments]

Categories
Misc

Best Machine Learning Books to read in 2022

Best Machine Learning Books to read in 2022 submitted by /u/maneesh123456
[visit reddit] [comments]
Categories
Misc

errors when trying to load dataset

I have been trying to develop my machine learning model dealing with Nifti files. I originally just loaded them into a numpy array but after augmentation the amount of data was too large for the RAM.

I discovered that one should make use of things such as generators / tools provided by tf.Data.

As such I attempted the following.

def load_images(imagePath): image = nib.load(imagePath) image = image.get_fdata() image = tf.image.per_image_standardization(image) label = (int)(imagePath.split('Grade')[1][0]) - 1 return (image, label) dataset = tf.data.Dataset.from_tensor_slices(all_paths) dataset = (dataset .shuffle(1024) .map(load_images, num_parallel_calls=AUTOTUNE) .cache() .repeat() .batch(64) .prefetch(AUTOTUNE) ) 

Hopefully the code is straightforward but if anything needs further clarification please do ask. Originally the first two lines of load_images() were it’s own function but I tried it like this to try and resolve the issue.

The issue is that I am getting the following error at the map line:

TypeError: in user code: File "<ipython-input-64-56e9744da5d3>", line 5, in load_images * image = nib.load(imagePath) File "/usr/local/lib/python3.7/dist-packages/nibabel/loadsave.py", line 42, in load * stat_result = os.stat(filename) TypeError: stat: path should be string, bytes, os.PathLike or integer, not Tensor 

I don’t think it likes me using nibabelfunctions in the mapping function but I cannot think of any other way to do it. I tried following the answer here but this just gave me another error about using tf.function

submitted by /u/15150776
[visit reddit] [comments]

Categories
Misc

Ultimate Guide to Activation Functions

submitted by /u/SirFletch
[visit reddit] [comments]