MJ106 commited on
Commit
fa7f040
·
verified ·
1 Parent(s): b7422b8

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +10 -3
index.js CHANGED
@@ -15,8 +15,11 @@ const EXAMPLE_URL = 'https://huggingface.co/datasets/Xenova/transformers.js-docs
15
  status.textContent = 'Loading model...';
16
  // To-Do #1 pipeline API를 사용하여 detr-resnet-50 object detection 모델의 instance를 detector라는 이름을 붙여 생성하십시오.
17
  // DETR 모델 참고 문서 https://huggingface.co/facebook/detr-resnet-50
18
- const detector = await '???';
19
- status.textContent = 'Ready';
 
 
 
20
 
21
  example.addEventListener('click', (e) => {
22
  e.preventDefault();
@@ -45,7 +48,11 @@ async function detect(img) {
45
 
46
  status.textContent = 'Analysing...';
47
  // To-Do #2 객체 탐지를 위한 오브젝트에 threshold를 0.5, percentage를 true로 지정하고 그 결과를 output에 저장하십시오
48
- const output = ???(
 
 
 
 
49
  // threshold 값을 지정하고 쉼표를 붙이시오
50
  // percentage 지정
51
  );
 
15
  status.textContent = 'Loading model...';
16
  // To-Do #1 pipeline API를 사용하여 detr-resnet-50 object detection 모델의 instance를 detector라는 이름을 붙여 생성하십시오.
17
  // DETR 모델 참고 문서 https://huggingface.co/facebook/detr-resnet-50
18
+ const detector = await pipeline.objectDetection ({
19
+ model: 'detr-resnet-50',
20
+ framework: 'tfjs',
21
+ )};
22
+ status.textContent = 'Ready';
23
 
24
  example.addEventListener('click', (e) => {
25
  e.preventDefault();
 
48
 
49
  status.textContent = 'Analysing...';
50
  // To-Do #2 객체 탐지를 위한 오브젝트에 threshold를 0.5, percentage를 true로 지정하고 그 결과를 output에 저장하십시오
51
+ const output = await detector({
52
+ image: img,
53
+ threshold: 0.5,
54
+ percentage: true,
55
+ });
56
  // threshold 값을 지정하고 쉼표를 붙이시오
57
  // percentage 지정
58
  );