首页 » Python代写 » Python代写|COMP-377 Lab Assignment #4 – Use CNNs in image classification problems

Python代写|COMP-377 Lab Assignment #4 – Use CNNs in image classification problems

这是一个加拿大的Python CNN图像分类作业代写

Exercise 1: Convolutional Neural Networks

In this exercise you will implement a CNN model for digit classification using tensorflow and MNIST dataset. The site https://www.tensorflow.org/api_docs/python/tf/keras/datasets/mnist/load_data will help you to figure out how to fetch the data using a special tensorflow function. Overall, use convolution layers and pooling layers that are eventually followed by a densely connected output layer. Here is the architecture of the network:

  • Use Conv2D for two hidden layers. They are activated by ReLU activation function
  • After each Conv2D layer, use a mean pooling operation.
  • Use Flatten operation.
  • Use Dense for the output layer. This layer is to be activated by softmax function.
  • Do not use Dropout operation in this architecture.

Do not use one-hot encoding of the target.

Compile the model using the loss function SparseCategoricalCrossentropy (You need to use this loss function since you must not use one-hot encoding of the target). Train the model using the top 60 rows out of 60000 rows of the training data (present in x_train; see below how to obtain the training data in x_train). Test the model using top 10 rows out of 10000 rows of test data (present in x_test; see below how to obtain the test data in x_test). Evaluate the accuracy of the model. Compare the result with those of the SVM model used in lab2.

Note: If you go down the webpage https://www.tensorflow.org/api_docs/python/tf/keras/datasets/mnist/load_data   you will see an example usage of the method keras.datasets.mnist.load_data. It returns four objects of type ndarray. Those four objects are x_train, x_test, y_train, y_test. Another file that could be of help is in a News item under the string 8.1.using.built-in.dataset.of.sklearn.digit.images.for.tensorflow.Conv2D.model.ipynb

It also has an associated video in the same News item under the string 8.1.using.built-in.dataset.of.sklearn.digit.images.for.tensorflow.Conv2D.model

Here is another tensorflow website that shows the current way of creating a CNN architecture:

https://www.tensorflow.org/tutorials/images/classification

(5 marks)

Exercise 2: Convolutional Neural Networks

In this exercise you will build a CNN model for photo classification using tensorflow and CIFAR-10 dataset. The site  https://www.tensorflow.org/api_docs/python/tf/keras/datasets/cifar10/load_data  will help you to figure out how to fetch the data using a special tensorflow function. Use the same technique as in Exercise 1 above to create the CNN architecture. Train the model using the top 50 rows out of 50000 rows of the training data (present in x_train; see below how to obtain the training data in x_train). Test the model using top 10 rows out of 10000 rows of test data (present in x_test; see below how to obtain the test data in x_test). Evaluate the accuracy of the model.

 

Note: If you go down the webpage https://www.tensorflow.org/api_docs/python/tf/keras/datasets/cifar10/load_data   you will see an example usage of the method keras.datasets.cifar10.load_data. It returns four objects of type ndarray. Those four objects are x_train, x_test, y_train, y_test. Another file that could be of help is in a News item under the string 8.1.using.built-in.dataset.of.sklearn.digit.images.for.tensorflow.Conv2D.model.ipynb

It also has an associated video in the same News item under the string 8.1.using.built-in.dataset.of.sklearn.digit.images.for.tensorflow.Conv2D.model.

 

Here is another tensorflow website that shows the current way of creating a CNN architecture:

https://www.tensorflow.org/tutorials/images/classification

(5 marks)

Evaluation:

Design and Functionality:

Correct design and implementation of requirements

Code explanation if asked

90%
Documentation of code using comments:

At least a single-line comment for each functionality

10%
 

Total

 

100%


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。