How to export and reload the model, and add image training on this basis #1438
Unanswered
GreenHandLJ
asked this question in
Q&A
Replies: 1 comment
-
Most of your code seems right, but I am not quite sure what exactly your question is. However, I notice that your dataset has 2 elements and you need to have much more than that. As a comparison, MNIST which is a pretty basic image dataset has 60,000 training images and 10,000 test images. To retrain a model, you can load it with |
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
Uh oh!
There was an error while loading. Please reload this page.
-
I want use "ImageFolder" as "DataSet" to create and train a new Model then export it,
when I have some new pictures, I can reload this model and train these new pictures on this model
I use different picture to predict ,but all results are the same.
Where can I find the demo
after directory:
models
shoeclassifier-0010.params
synset.txt
result:
[
class: "大蒜", probability: 1.00000
class: "包菜", probability: 0.0e+00
]
Training:
public final class Training {
// ImageFolder dataset = initDataset(new File("E:\ai\ai\data\training\min2").toPath());//size 1
// ImageFolder datasetValiddate = initDataset(new File("E:\ai\ai\data\validate\min2").toPath());//size 1
TrainingConfig config = setupTrainingConfig(Loss.softmaxCrossEntropyLoss());
Model model = Model.newInstance(Models.MODEL_NAME);
Block resNet50 =
ResNetV1.builder() // construct the network
.setImageShape(new Shape(3, IMAGE_HEIGHT, IMAGE_WIDTH))
.setNumLayers(50)
.setOutSize(3)
.build();
model.setBlock(resNet50);
//load exits model
if (modelDir.toFile().exists()) {
model.load(modelDir, Models.MODEL_NAME);
}
}
predict:
public class Inference {
}
Beta Was this translation helpful? Give feedback.
All reactions