Hi everyone, this is my first post here - hopefully it is ok to ask for advice when just learning and testing Django!
I would want to create a web app where users contribute to the same machine learning model (local server fine at this stage). This means that they would upload or choose an image (an updating image on main page based on JSON) in their browser and classify it with a button A or B. This click would either add a training example via transfer learning or, at least, save the image file with the label so that those new examples can be added to training set (folders A and B) later and then training would be called again. Thus, I am interested in creating a teachable machine that collects image+label combinations from users and learns.
I obviously know that a lot depends on the ML model; here I would appreciate hearing if this sounds reasonable in Django and, if yes, where to look for more information. I managed to get this tutorial working: https://www.youtube.com/watch?v=mgX-2_ybqNk
He uses these views for predictions and showing the images uploaded by users, I was wondering if a similar view could be called to add one image and label to dataset as well:
> def predictImage(request):
> print(request)
> print(request.POST.dict())
> fileObj = request.FILES['filePath']
> fs=FileSystemStorage()
> filePathName=fs.save(fileObj.name, fileObj)
> filePathName = fs.url(filePathName)
> testimage = '.' + filePathName
> img = image.load_img(testimage, target_size=(img_height, img_width))
> x = image.img_to_array(img)
> x = x / 255
> x = x.reshape(1, img_height, img_width, 3)
> #with model_graph.as_default():
> # with tf_session.as_default():
> predi = model.predict(x)
>
> import numpy as np
> predictedLabel = labelInfo[str(np.argmax(predi[0]))]
>
> context = {'filePathName':filePathName, 'predictedLabel':predictedLabel[1]}
> return render(request, 'index.html', context)
>
>
> def viewDataBase(request):
> import os
> listOfImages = os.listdir('./media/')
> listOfImagesPath = ['./media/' + i for i in listOfImages]
> context = {'listOfImagesPath': listOfImagesPath}
> return render(request, 'viewDB.html', context)
Many thanks if you have time to share thoughts!