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

Update .gitignore #3

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@

.DS_Store
.env
.pt
yolov7-e6e.pt
1 change: 1 addition & 0 deletions 2.4.1'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Defaulting to user installation because normal site-packages is not writeable
1 change: 1 addition & 0 deletions 4.1.1'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Defaulting to user installation because normal site-packages is not writeable
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 565000008992603.webp
Binary file not shown.
Binary file added __pycache__/app.cpython-310.pyc
Binary file not shown.
33 changes: 29 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import base64
import io
from operator import truediv
import os
import json
from PIL import Image

import logging
import numpy as np
import torch
from flask import Flask, jsonify, url_for, render_template, request, redirect

from flask import Flask, jsonify, url_for, render_template, request, redirect,send_file
from PIL import Image as im
app = Flask(__name__)

RESULT_FOLDER = os.path.join('static')
Expand All @@ -20,7 +22,7 @@ def find_model():
print("please place a model file in this directory!")

model_name = find_model()
model =torch.hub.load("WongKinYiu/yolov7", 'custom',model_name)
model =torch.hub.load("ultralytics/yolov5", 'custom',model_name)

model.eval()

Expand Down Expand Up @@ -48,6 +50,29 @@ def predict():
return render_template('result.html',result_image = filename,model_name = model_name)

return render_template('index.html')
@app.route('/check', methods=['GET', 'POST'])
def predict_check():
if request.method == 'POST':
if 'file' not in request.files:
return redirect(request.url)
file = request.files.get('file')
if not file:
return

img_bytes = file.read()
results = get_prediction(img_bytes)
imagecheck = np.squeeze(results.render())
#encoded_string= base64.b64encode(imagecheck)
data = im.fromarray(imagecheck)
encoded_string= base64.b64encode(data.tobytes())
#app.logger.info(print(type(encoded_string)))
response = {
'Status': 'Success',
'message': 'Success',
'ImageBytes': str(encoded_string)
}
return jsonify(response)

@app.route('/detect', methods=['GET', 'POST'])
def handle_video():
# some code to be implemented later
Expand Down
Binary file added buldog.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added buldog2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions data (1).yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
names:
- African_hunting_dog
- Chihuahua
- Lhasa
- Pembroke
- Pomeranian
- Saint_Bernard
- Yorkshire_terrier
- basset
- beagle
- borzoi
- boxer
- chow
- collie
- dingo
- golden_retriever
- malamute
- malinois
- papillon
- pug
- standard_schnauzer
nc: 20
train: Doggos-1/train/images
val: Doggos-1/valid/images
24 changes: 24 additions & 0 deletions data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
names:
- African_hunting_dog
- Chihuahua
- Lhasa
- Pembroke
- Pomeranian
- Saint_Bernard
- Yorkshire_terrier
- basset
- beagle
- borzoi
- boxer
- chow
- collie
- dingo
- golden_retriever
- malamute
- malinois
- papillon
- pug
- standard_schnauzer
nc: 20
train: Doggos-1/train/images
val: Doggos-1/valid/images
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dog_noun_001_04904.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dogpark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added last.pt
Binary file not shown.
37 changes: 37 additions & 0 deletions opt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
weights: ''
cfg: ./models/custom_yolov5s.yaml
data: /kaggle/working/yolov5/Doggos-1/data.yaml
hyp: data/hyp.scratch.yaml
epochs: 350
batch_size: 32
img_size:
- 416
- 416
rect: false
resume: false
nosave: false
notest: false
noautoanchor: false
evolve: false
bucket: ''
cache_images: true
image_weights: false
device: ''
multi_scale: false
single_cls: false
adam: false
sync_bn: false
local_rank: -1
log_imgs: 16
log_artifacts: false
workers: 8
project: runs/train
entity: null
name: yolov5s_results
exist_ok: false
quad: false
linear_lr: false
world_size: 1
global_rank: -1
save_dir: runs/train/yolov5s_results
total_batch_size: 32
Binary file added pug.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added pug2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added requirements.txt
Binary file not shown.
1 change: 1 addition & 0 deletions response.json

Large diffs are not rendered by default.

Binary file modified static/image0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.