mlpack / models

models built with mlpack
https://models.mlpack.org/docs
BSD 3-Clause "New" or "Revised" License
33 stars 42 forks source link

dataloader.LoadImageDatasetFromDirectory can not be used because error impl in Augmentation::ResizeTransform #82

Closed peichao538 closed 9 months ago

mlpack-bot[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! :+1:

rcurtin commented 11 months ago

Can you paste what the actual error is? I am not very familiar with this code, but I'm happy to try and take a look to see what is wrong and if there is an easy fix.

peichao538 commented 11 months ago

Can you paste what the actual error is? I am not very familiar with this code, but I'm happy to try and take a look to see what is wrong and if there is an easy fix.

Augmentation::ResizeTransform use mlpack::BilinearInterpolation to process image data, but mlpack::BilinearInterpolation has not been modified and adapted, so some project cannot be compiled and the function of "dataloader" also can not been used to process image directly. I have changed the code with a simple comment as shown in the pasted below, and have not completely implemented BilinearInterpolationType.

template void Augmentation::ResizeTransform( DatasetType& dataset, const size_t datapointWidth, const size_t datapointHeight, const size_t datapointDepth, const std::string& augmentation) { size_t outputWidth = 0, outputHeight = 0;

// Get output width and output height. GetResizeParam(outputWidth, outputHeight, augmentation);

// We will use mlpack's bilinear interpolation layer to // resize the input. // mlpack::BilinearInterpolation<DatasetType, DatasetType> resizeLayer( // datapointWidth, datapointHeight, outputWidth, outputHeight, // datapointDepth); // mlpack::BilinearInterpolation<DatasetType, DatasetType> resizeLayer( // datapointWidth, datapointHeight, outputWidth, outputHeight, // datapointDepth); mlpack::BilinearInterpolation resizeLayer( outputWidth, outputHeight);

DatasetType output; resizeLayer.Forward(dataset, output); dataset = std::move(output); }

rcurtin commented 11 months ago

Right, that layer has not been adapted yet. If you are interested in doing the work of adapting the layer and opening a PR on the mlpack repository, it would be greatly appreciated! I don't currently have time for it (but will get around to it eventually).

mlpack-bot[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! :+1: