0

I have uploaded a folder of google drive with all of my files .It's structure is like -

MyFolder
 -Images
 -train.py 
 -classify.py
 -Facenet.py

I mounter the folder by following instruction on How to Upload Many Files to Google Colab? In my computer i simply go to MyFolder , i open the terminal and i run python train.py .How to do same thing in google colab ? I have uploaded MyFolder on google drive.

Edit : After mounting i changed my directory to MyFolder (credits : Google colab changing directory) .I have runned train.py , it's still running .I hoper everything works fine . So now all i want to know that all changes caused after running the script will be stored in MyFolder of drive itself ?

My problem is solved .Two links mentioned are enough.

desertnaut
  • 57,590
  • 26
  • 140
  • 166
  • A mounting issue in Google colab is certainly not a problem related to `artificial-intelligence` - kindly do not spam irrelevant tags (removed). Plus, you may prefer to post your solution as an **answer** and accept it, so that it may be useful for others in the future (and save time from people trying to read your post thinking that the question still holds, while it does not). – desertnaut Nov 01 '19 at 16:33
  • @desertnaut Done .Can you help me in https://stackoverflow.com/questions/58660486/three-step-threshold-in-facenet-model-of-face-recogniton .I think you have information .Also i have implemented whatever you suggested me to implement in that post . –  Nov 01 '19 at 17:04
  • Not sure why you are under the impression that I have info - if I knew how to answer, I would already have; that question is still too broad for SO, as almost all *verbal* descriptions of a problem actually are. – desertnaut Nov 01 '19 at 19:50

1 Answers1

0

First upload MyFolder on google drive .Then go to google colab (using same gmail account).Copy and paste the following script and run on google colab .(see How to Upload Many Files to Google Colab?)

# Install a Drive FUSE wrapper.
# https://github.com/astrada/google-drive-ocamlfuse
!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse



# Generate auth tokens for Colab
from google.colab import auth
auth.authenticate_user()


# Generate creds for the Drive FUSE library.
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}


# Create a directory and mount Google Drive using that directory.
!mkdir -p My Drive
!google-drive-ocamlfuse My Drive


!ls My Drive/

# Create a file in Drive.
!echo "This newly created file will appear in your Drive file list." > My Drive/created.txt

After than you can use command %cd Drive/ to move to the drive and then command %cd MyFolder to move inside Myfolder .see Google colab changing directory .You can run terminal commands of Linux using % or ! at the beginning of you command statement.to train the data run the corresponding command .

!python train.py