Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
lidongyue12138 committed Jun 4, 2019
1 parent ab64f9d commit a04f24e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,7 @@ ENV/
.ropeproject


*.jpg
*.txt
*.png
Datasets/CUB_200_2011/README
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"python.pythonPath": "D:\\Anaconda\\envs\\ldy\\python.exe"
"python.pythonPath": "D:\\Anaconda\\envs\\ldy\\python.exe",
"git.ignoreLimitWarning": true
}
2 changes: 0 additions & 2 deletions keras_segmentation/data_utils/data_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
class_colors = [ ( random.randint(0,255),random.randint(0,255),random.randint(0,255) ) for _ in range(5000) ]




def get_pairs_from_paths( images_path , segs_path, recursive = True ):
if recursive == True:
images = glob.glob(
Expand Down
22 changes: 22 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import keras_segmentation
import os

images_path = "./Datasets/CUB_200_2011/images/"
segs_path = "./Datasets/CUB_200_2011/segmentations/"

model = keras_segmentation.models.unet.vgg_unet(n_classes=51 , input_height=416, input_width=608 )

model.train(
train_images = images_path,
train_annotations = segs_path,
checkpoints_path = "/tmp/vgg_unet_1" , epochs=5
)

out = model.predict_segmentation(
inp= os.path.join(images_path, "001.Black_footed_Albatross", "Black_footed_Albatross_0001_796111.jpg"),
out_fname="/tmp/out.png"
)


import matplotlib.pyplot as plt
plt.imshow(out)

0 comments on commit a04f24e

Please sign in to comment.