Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic recognition - 45799930 #437

Open
wants to merge 28 commits into
base: topic-recognition
Choose a base branch
from

Conversation

sully36
Copy link

@sully36 sully36 commented Oct 21, 2022

Student 45799930
The problem I implemented was the improved UNet on the ISIC dataset. The implementation of the UNet went well. However, I believe there was an issue with implementing the dice similarity coefficient. This is because when doing the training, the value stays constant for both the training and the validation data. However, the loss goes down with the epoch.
Please note that about half the time when running it, it comes up with an error. However, if you run it again (you may have to try twice), it runs with no problem. I haven't been able to identify the problem but the error. The error comes up with 'model/conv2d/Relu'
input depth must be evenly divisible by filter depth: 1 vs 3

The initial setup has been done on pycharm and a folder in the recognition directory has been added called 45799930 (my student number). All files required for this assignment have been added under this directory.
Class code for importing the datasets and converting the filenames into TensorFlow datasets
The initialisation of class variables was incorrect, as well as the file path names for the folders containing the data. Also added in a check to make sure the truth for every set is the same size of that set.
Added proper docstrings for the function in the class. I also added some new class variables so we can access the width and height of the images.
The function to create the model has been created with the improved UNet structure.  I have done the downsampling through the 5 layers and upsampling back up. But have not implemented the segmentation layer and concatenated them from layers 3, 2 and 1, which are at the end of the structure.
Created context_module function as this cleaned up the create_module function as it was getting messy and hard to understand. Made sure to normalise and have the dropout layer in between the two conv layers.
Added module function for upsampling to clean up the create_model function.
Based on the improved UNet need to change the Maxpooling to a Conv with a stride of 2. I also needed to add the element-wise sum for the encoder side of things. The encoder structure should be complete now.
Added documentation for the new functions created and changed the spacing of the encoder part of create_module so it corresponds with the layers on the improved UNet. structure.
Added localisation module function to clean up create module function. I changed the concatenate lines as they were doing one of the wrong variables. Added the segmentation layers as well at the end, the element-wise sum of them and added the softmax layer to finish off the module.
Title and subtitles added to README.md based on requirements stated in the task sheet in the README description and its marking criteria.
Added information for the address reproducibility for this assignment to run in the README.md file.
Imported needed functions from modules and classes from datasets. Also calls these in the init method so that immediately we get the dataset and module created.
A function was created in train.py, which calculates the dice similarity coefficient of two images that will be passed in as tensors. This is based on the link in the task sheet.
Found the need to preprocess the data because the dataset in past has just contained the path to the images so created this method so that we can map the data to the right location.
Changed download_dataset so that it automatically processes the data. This then meant class variable names were changed, which had a flow-on effect through the class and separated the processing of the image and the truth as I would otherwise have to change my dataset into a tuple for the data and truth sets.
Added key information on the preprocessing of the data that was just compleated. Also added some small changes, such as Author and student ID and did some more basic formatting to make it clearer to read.
added doc strings to the functions that were missing their own while modifying others that had changed since they were first written.
I had problems trying to implement model.fit and using batch with the current structure of the data, so I found out it would be easier if used from_tensor_slices to make them into tensors with two elements.
When running, there was a problem with using from_tensor_slices twice as it had one of the dimensions as none, and we couldn’t combine two tensors like that. It was changed so when the tensor slices are first called it forms two-dimensional tensors. This means the pre_processing had to be combined as passing it into the map with include both the image and truth
The initial element-wise sum was trying to sum up the wrong variable, so they were in incompatible shapes. Segmentation layers when trying to add were also in the wrong shaps so added upsampling where required.
Function created to print out the result of the epochs once the model has been trained. Changed to functions rather than a class as the class structure is not required and makes it more complex.
Instead of using all the datasets, as there is already a large amount of data in the training dataset, we split that dataset into three o create all the testing, training and validating data sets. The same was done for the truth. This them was updated in the readme
Added all the information and justification on the split of the datasets in the readme file.
Added information for what the algorithm is that we are using and the problem that it solves to the readme. Images were added to the readme so a images folder was also added for ease and cleanliness.
Added graphs for the output of the program and added the rest of the information for the read me
Added the main function in predict and modified the print of the history as accuracy has changed to the dice coefficent.
Changed so that the original image should have 3 channels so that it is an RBG image. This seemed to fix the error that would only occur sometimes.
@SiyuLiu0329
Copy link
Collaborator

This is an initial inspection, no action is required at this point

  • Code: OK overall, but model not training. Possible fix 1) make network output 1 channel 2) ensure mask is 1 channel with 0s and 1s only.
  • Results: good attempt but results not idea due to some errors in code
  • Readme: some image links are broken;
  • Commit Messages: OK
  • Other comments: please do not commit .DS_Store

@shakes76
Copy link
Owner

Good Practice (Design/Commenting, TF/Torch Usage)

Adequate use and implementation (not fully functional, no improvement to accuracy) -4
Good spacing and comments
Header blocks missing -1

Recognition Problem

Solves problem (no results) -3
Driver Script present
File structure present
Shows Usage & Demo & Visualisation & Data usage (no outputs) -2
Module present
Commenting
No Data leakage (no testing) -2
Difficulty: Easy -10

Commit Log

Meaningful commit messages
Progressive commits used

Documentation

ReadMe acceptable
Good Description and Comments
Markdown used PDF submitted

Pull Request

Successful Pull Request (Working Algorithm Delivered on Time in Correct Branch)
Feedback required, remove extra files like .idea folder, DS_store etc. -2
Request Description OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants