Question: Transfer learning. You want to build a classifier that detects bicycles in images. In each sample, the input to the classifier is a set of

 Transfer learning. You want to build a classifier that detects bicycles

Transfer learning. You want to build a classifier that detects bicycles in images. In each sample, the input to the classifier is a set of 5 photos of some scene taken at different angles. Each photo is an RGB image of size 128128. The output of the classifier is a single binary value, 0 or 1 , for each sample, indicating if there was a bicycle in any of the five photos in the sample. (a) You want to write the classifier that takes a set of samples x and return a set of predictions yhat. What should the shape of x and yhat be? (b) You are given an excellent pre-trained image classifier that works on a single 128128 RGB image. The pre-trained classifier was trained on 1000 image classes and can be accessed by: Z=pretrained.predict(X)#Outputsthelogitsforthe1000classes Suppose that in the pre-trained classifier, bicycles were one of the image classes, say class 50. Write a possible implementation of a classifier using the pretrained model: def classify(X, pretrained): return yhat There is no single correct answer. Do something reasonable with an explanation. (c) Now suppose that bicycles were not one of the image classes that the pretrained classifier uses. So, you decide to transfer learn using the outputs of one of the layers near the end of the pre-trained model using simple logistic regression on those outputs. Assume you have the following functions: \# Outputs the 2000 hidden units at some layer near the \# end of the pre-trained model Z = pretrain_base.predict (X) reg = LogisticRegression() \# Builds a logistic regression object reg.fit(X,y) \# Fits the logistic model from X to y yhat = reg.predict (X)# Predicts binary outputs Write functions to fit and predict the pre-trained model: def fit(Xtr,ytr,..) .. return ... defpredict(X,) . . return yhat The functions should take whatever inputs and outputs are necessary

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!